mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge bug 464598.
This commit is contained in:
commit
2e7a255635
@ -43,11 +43,7 @@
|
||||
}
|
||||
|
||||
.searchbar-engine-button[addengines="true"] {
|
||||
background-color: Highlight;
|
||||
}
|
||||
|
||||
.searchbar-engine-button[addengines="true"] > .button-box {
|
||||
background-color: rgba(230, 230, 230, 0.3);
|
||||
-moz-box-shadow: 0 0 5px Highlight inset, 0 0 20px Highlight inset;
|
||||
}
|
||||
|
||||
.searchbar-dropmarker-image {
|
||||
|
@ -92,6 +92,11 @@
|
||||
#include "nsIWindowWatcher.h"
|
||||
#include "nsCommaSeparatedTokenizer.h"
|
||||
|
||||
// XXX: Needed for debugging bug 471227, these two includes should not
|
||||
// stick around
|
||||
#include <nsIApplicationCache.h>
|
||||
#include <nsIApplicationCacheChannel.h>
|
||||
|
||||
#define LOAD_STR "load"
|
||||
#define ERROR_STR "error"
|
||||
#define ABORT_STR "abort"
|
||||
@ -2300,6 +2305,30 @@ nsXMLHttpRequest::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult
|
||||
// reasons are that the user leaves the page or hits the ESC key.
|
||||
Error(nsnull);
|
||||
|
||||
{
|
||||
// XXX: Some debugging spew for bug 471227, this should not stay
|
||||
// in the tree.
|
||||
|
||||
// verify whether the application cache channel was associated
|
||||
// with a channel.
|
||||
nsCOMPtr<nsIApplicationCacheChannel> appCacheChannel =
|
||||
do_QueryInterface(request);
|
||||
nsCOMPtr<nsIApplicationCache> appCache;
|
||||
if (appCacheChannel) {
|
||||
appCacheChannel->GetApplicationCache(getter_AddRefs(appCache));
|
||||
}
|
||||
|
||||
nsCAutoString spec;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
channel->GetURI(getter_AddRefs(uri));
|
||||
if (uri) {
|
||||
uri->GetSpec(spec);
|
||||
}
|
||||
|
||||
printf("(Bug 471227): XHR failed for %s: status: %x, appcache: %p\n",
|
||||
spec.get(), status, appCache.get());
|
||||
}
|
||||
|
||||
// By nulling out channel here we make it so that Send() can test
|
||||
// for that and throw. Also calling the various status
|
||||
// methods/members will not throw.
|
||||
|
@ -2162,7 +2162,9 @@ struct NS_STACK_CLASS nsCanvasBidiProcessor : public nsBidiPresUtils::BidiProces
|
||||
{
|
||||
gfxTextRun::Metrics textRunMetrics = mTextRun->MeasureText(0,
|
||||
mTextRun->GetLength(),
|
||||
mDoMeasureBoundingBox,
|
||||
mDoMeasureBoundingBox ?
|
||||
gfxFont::TIGHT_INK_EXTENTS :
|
||||
gfxFont::LOOSE_INK_EXTENTS,
|
||||
mThebes,
|
||||
nsnull);
|
||||
|
||||
|
@ -354,6 +354,9 @@ private:
|
||||
// run. This allows coalescing of these events as they can be produced
|
||||
// many times per second.
|
||||
PRPackedBool mPositionChangeQueued;
|
||||
|
||||
// True if paused. Tracks only the play/paused state.
|
||||
PRPackedBool mPaused;
|
||||
};
|
||||
|
||||
nsWaveStateMachine::nsWaveStateMachine(nsWaveDecoder* aDecoder, nsMediaStream* aStream,
|
||||
@ -379,7 +382,8 @@ nsWaveStateMachine::nsWaveStateMachine(nsWaveDecoder* aDecoder, nsMediaStream* a
|
||||
mTimeOffset(0),
|
||||
mSeekTime(0.0),
|
||||
mMetadataValid(PR_FALSE),
|
||||
mPositionChangeQueued(PR_FALSE)
|
||||
mPositionChangeQueued(PR_FALSE),
|
||||
mPaused(mNextState == STATE_PAUSED)
|
||||
{
|
||||
mMonitor = nsAutoMonitor::NewMonitor("nsWaveStateMachine");
|
||||
mDownloadStatistics.Start(PR_IntervalNow());
|
||||
@ -400,6 +404,7 @@ void
|
||||
nsWaveStateMachine::Play()
|
||||
{
|
||||
nsAutoMonitor monitor(mMonitor);
|
||||
mPaused = PR_FALSE;
|
||||
if (mState == STATE_LOADING_METADATA || mState == STATE_SEEKING) {
|
||||
mNextState = STATE_PLAYING;
|
||||
} else {
|
||||
@ -431,6 +436,7 @@ void
|
||||
nsWaveStateMachine::Pause()
|
||||
{
|
||||
nsAutoMonitor monitor(mMonitor);
|
||||
mPaused = PR_TRUE;
|
||||
if (mState == STATE_LOADING_METADATA || mState == STATE_SEEKING) {
|
||||
mNextState = STATE_PAUSED;
|
||||
} else {
|
||||
@ -722,14 +728,21 @@ nsWaveStateMachine::Run()
|
||||
}
|
||||
|
||||
if (mState == STATE_SEEKING && mSeekTime == seekTime) {
|
||||
// Special case: if a seek was requested during metadata load,
|
||||
// Special case #1: if a seek was requested during metadata load,
|
||||
// mNextState will have been clobbered. This can only happen when
|
||||
// we're instantiating a decoder to service a seek request after
|
||||
// playback has ended, so we know that the clobbered mNextState
|
||||
// was PAUSED.
|
||||
// Special case #2: if a seek is requested after the state machine
|
||||
// entered STATE_ENDED but before the user has seen the ended
|
||||
// event, playback has not ended as far as the user's
|
||||
// concerned--the state machine needs to return to the last
|
||||
// playback state.
|
||||
State nextState = mNextState;
|
||||
if (nextState == STATE_SEEKING) {
|
||||
nextState = STATE_PAUSED;
|
||||
} else if (nextState == STATE_ENDED) {
|
||||
nextState = mPaused ? STATE_PAUSED : STATE_PLAYING;
|
||||
}
|
||||
ChangeState(nextState);
|
||||
}
|
||||
@ -757,14 +770,14 @@ nsWaveStateMachine::Run()
|
||||
monitor.Enter();
|
||||
}
|
||||
|
||||
if (mState != STATE_SHUTDOWN) {
|
||||
if (mState == STATE_ENDED) {
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
NS_NEW_RUNNABLE_METHOD(nsWaveDecoder, mDecoder, PlaybackEnded);
|
||||
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
while (mState != STATE_SHUTDOWN) {
|
||||
monitor.Wait();
|
||||
do {
|
||||
monitor.Wait();
|
||||
} while (mState == STATE_ENDED);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -823,6 +836,9 @@ IsValidStateTransition(State aStartState, State aEndState)
|
||||
return PR_TRUE;
|
||||
break;
|
||||
case STATE_ENDED:
|
||||
if (aEndState == STATE_SEEKING)
|
||||
return PR_TRUE;
|
||||
/* fallthrough */
|
||||
case STATE_ERROR:
|
||||
case STATE_SHUTDOWN:
|
||||
break;
|
||||
@ -1428,6 +1444,10 @@ nsWaveDecoder::PlaybackEnded()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mPlaybackStateMachine->IsEnded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Stop();
|
||||
if (mElement) {
|
||||
mElement->PlaybackEnded();
|
||||
|
@ -2,7 +2,7 @@ var extendDefault = function(options) {
|
||||
return Object.extend({
|
||||
asynchronous: false,
|
||||
method: 'get',
|
||||
onException: function(e) { throw e }
|
||||
onException: function(request, e) { throw e }
|
||||
}, options);
|
||||
};
|
||||
|
||||
@ -21,11 +21,11 @@ new Test.Unit.Runner({
|
||||
this.assertEqual("", $("content").innerHTML);
|
||||
|
||||
this.assertEqual(0, Ajax.activeRequestCount);
|
||||
new Ajax.Request("../fixtures/hello.js", {
|
||||
new Ajax.Request("../fixtures/hello.js", extendDefault({
|
||||
asynchronous: false,
|
||||
method: 'GET',
|
||||
evalJS: 'force'
|
||||
});
|
||||
}));
|
||||
this.assertEqual(0, Ajax.activeRequestCount);
|
||||
|
||||
var h2 = $("content").firstChild;
|
||||
@ -35,11 +35,11 @@ new Test.Unit.Runner({
|
||||
testAsynchronousRequest: function() {
|
||||
this.assertEqual("", $("content").innerHTML);
|
||||
|
||||
new Ajax.Request("../fixtures/hello.js", {
|
||||
new Ajax.Request("../fixtures/hello.js", extendDefault({
|
||||
asynchronous: true,
|
||||
method: 'get',
|
||||
evalJS: 'force'
|
||||
});
|
||||
}));
|
||||
this.wait(1000, function() {
|
||||
var h2 = $("content").firstChild;
|
||||
this.assertEqual("Hello world!", h2.innerHTML);
|
||||
|
@ -423,7 +423,9 @@ nsGnomeVFSInputStream::DoOpen()
|
||||
// throws hands up in the air and moves on...)
|
||||
|
||||
GnomeVFSFileInfo info = {0};
|
||||
rv = gnome_vfs_get_file_info(mSpec.get(), &info, GNOME_VFS_FILE_INFO_DEFAULT);
|
||||
rv = gnome_vfs_get_file_info(mSpec.get(), &info, GnomeVFSFileInfoOptions(
|
||||
GNOME_VFS_FILE_INFO_DEFAULT |
|
||||
GNOME_VFS_FILE_INFO_FOLLOW_LINKS));
|
||||
if (rv == GNOME_VFS_OK)
|
||||
{
|
||||
if (info.type == GNOME_VFS_FILE_TYPE_DIRECTORY)
|
||||
|
@ -48,6 +48,8 @@ ignore-rank0.patch: bug 474886; Not redrawing the background when changing page
|
||||
|
||||
win32-canvas-glyph-position.patch: bug 475092; horizontal positioning errors when drawing glyph runs with delta-y offsets to canvas through win32-font
|
||||
|
||||
win32-cleartype-clipping.patch: bug 445087; some glyphs are clipped, mainly on right-hand edge, when ClearType is enabled and drawing to RGBA canvas
|
||||
|
||||
==== pixman patches ====
|
||||
|
||||
endian.patch: include cairo-platform.h for endian macros
|
||||
|
@ -986,6 +986,19 @@ _cairo_win32_scaled_font_init_glyph_metrics (cairo_win32_scaled_font_t *scaled_f
|
||||
&metrics, 0, NULL, &matrix) == GDI_ERROR) {
|
||||
status = _cairo_win32_print_gdi_error ("_cairo_win32_scaled_font_init_glyph_metrics:GetGlyphOutlineW");
|
||||
memset (&metrics, 0, sizeof (GLYPHMETRICS));
|
||||
} else {
|
||||
if (metrics.gmBlackBoxX > 0 && scaled_font->base.options.antialias != CAIRO_ANTIALIAS_NONE) {
|
||||
/* The bounding box reported by Windows supposedly contains the glyph's "black" area;
|
||||
* however, antialiasing (especially with ClearType) means that the actual image that
|
||||
* needs to be rendered may "bleed" into the adjacent pixels, mainly on the right side.
|
||||
* To avoid clipping the glyphs when drawn by _cairo_surface_fallback_show_glyphs,
|
||||
* for example, or other code that uses glyph extents to determine the area to update,
|
||||
* we add a pixel of "slop" to left side of the nominal "black" area returned by GDI,
|
||||
* and two pixels to the right (as tests show some glyphs bleed into this column).
|
||||
*/
|
||||
metrics.gmptGlyphOrigin.x -= 1;
|
||||
metrics.gmBlackBoxX += 3;
|
||||
}
|
||||
}
|
||||
cairo_win32_scaled_font_done_font (&scaled_font->base);
|
||||
if (status)
|
||||
|
23
gfx/cairo/win32-cleartype-clipping.patch
Normal file
23
gfx/cairo/win32-cleartype-clipping.patch
Normal file
@ -0,0 +1,23 @@
|
||||
diff --git a/gfx/cairo/cairo/src/cairo-win32-font.c b/gfx/cairo/cairo/src/cairo-win32-font.c
|
||||
--- a/gfx/cairo/cairo/src/cairo-win32-font.c
|
||||
+++ b/gfx/cairo/cairo/src/cairo-win32-font.c
|
||||
@@ -986,6 +986,19 @@ _cairo_win32_scaled_font_init_glyph_metr
|
||||
&metrics, 0, NULL, &matrix) == GDI_ERROR) {
|
||||
status = _cairo_win32_print_gdi_error ("_cairo_win32_scaled_font_init_glyph_metrics:GetGlyphOutlineW");
|
||||
memset (&metrics, 0, sizeof (GLYPHMETRICS));
|
||||
+ } else {
|
||||
+ if (metrics.gmBlackBoxX > 0 && scaled_font->base.options.antialias != CAIRO_ANTIALIAS_NONE) {
|
||||
+ /* The bounding box reported by Windows supposedly contains the glyph's "black" area;
|
||||
+ * however, antialiasing (especially with ClearType) means that the actual image that
|
||||
+ * needs to be rendered may "bleed" into the adjacent pixels, mainly on the right side.
|
||||
+ * To avoid clipping the glyphs when drawn by _cairo_surface_fallback_show_glyphs,
|
||||
+ * for example, or other code that uses glyph extents to determine the area to update,
|
||||
+ * we add a pixel of "slop" to left side of the nominal "black" area returned by GDI,
|
||||
+ * and two pixels to the right (as tests show some glyphs bleed into this column).
|
||||
+ */
|
||||
+ metrics.gmptGlyphOrigin.x -= 1;
|
||||
+ metrics.gmBlackBoxX += 3;
|
||||
+ }
|
||||
}
|
||||
cairo_win32_scaled_font_done_font (&scaled_font->base);
|
||||
if (status)
|
@ -438,7 +438,10 @@ GetTextRunBoundingMetrics(gfxTextRun *aTextRun, PRUint32 aStart, PRUint32 aLengt
|
||||
{
|
||||
StubPropertyProvider provider;
|
||||
gfxTextRun::Metrics theMetrics =
|
||||
aTextRun->MeasureText(aStart, aLength, PR_TRUE, aContext->ThebesContext(), &provider);
|
||||
aTextRun->MeasureText(aStart, aLength, gfxFont::TIGHT_HINTED_OUTLINE_EXTENTS,
|
||||
aContext->ThebesContext(), &provider);
|
||||
// note that TIGHT_UNHINTED_OUTLINE_EXTENTS can be expensive (on Windows)
|
||||
// but this is only used for MathML positioning so it's not critical
|
||||
|
||||
aBoundingMetrics.leftBearing = NSToCoordFloor(theMetrics.mBoundingBox.X());
|
||||
aBoundingMetrics.rightBearing = NSToCoordCeil(theMetrics.mBoundingBox.XMost());
|
||||
|
@ -507,6 +507,33 @@ protected:
|
||||
public:
|
||||
virtual ~gfxFont();
|
||||
|
||||
// options for the kind of bounding box to return from measurement
|
||||
typedef enum {
|
||||
LOOSE_INK_EXTENTS,
|
||||
// A box that encloses all the painted pixels, and may
|
||||
// include sidebearings and/or additional ascent/descent
|
||||
// within the glyph cell even if the ink is smaller.
|
||||
TIGHT_INK_EXTENTS,
|
||||
// A box that tightly encloses all the painted pixels
|
||||
// (although actually on Windows, at least, it may be
|
||||
// slightly larger than strictly necessary because
|
||||
// we can't get precise extents with ClearType).
|
||||
TIGHT_HINTED_OUTLINE_EXTENTS
|
||||
// A box that tightly encloses the glyph outline,
|
||||
// ignoring possible antialiasing pixels that extend
|
||||
// beyond this.
|
||||
// NOTE: The default implementation of gfxFont::Measure(),
|
||||
// which works with the glyph extents cache, does not
|
||||
// differentiate between this and TIGHT_INK_EXTENTS.
|
||||
// Whether the distinction is important depends on the
|
||||
// antialiasing behavior of the platform; currently the
|
||||
// distinction is only implemented in the gfxWindowsFont
|
||||
// subclass, because of ClearType's tendency to paint
|
||||
// outside the hinted outline.
|
||||
// Also NOTE: it is relatively expensive to request this,
|
||||
// as it does not use cached glyph extents in the font.
|
||||
} BoundingBoxType;
|
||||
|
||||
const nsString& GetName() const { return mFontEntry->Name(); }
|
||||
const gfxFontStyle *GetStyle() const { return &mStyle; }
|
||||
|
||||
@ -576,7 +603,7 @@ public:
|
||||
gfxFloat mDescent; // always non-negative
|
||||
|
||||
// Bounding box that is guaranteed to include everything drawn.
|
||||
// If aTightBoundingBox was set to true when these metrics were
|
||||
// If a tight boundingBox was requested when these metrics were
|
||||
// generated, this will tightly wrap the glyphs, otherwise it is
|
||||
// "loose" and may be larger than the true bounding box.
|
||||
// Coordinates are relative to the baseline left origin, so typically
|
||||
@ -633,7 +660,7 @@ public:
|
||||
*/
|
||||
virtual RunMetrics Measure(gfxTextRun *aTextRun,
|
||||
PRUint32 aStart, PRUint32 aEnd,
|
||||
PRBool aTightBoundingBox,
|
||||
BoundingBoxType aBoundingBoxType,
|
||||
gfxContext *aContextForTightBoundingBox,
|
||||
Spacing *aSpacing);
|
||||
/**
|
||||
@ -950,10 +977,10 @@ public:
|
||||
/**
|
||||
* Computes the ReflowMetrics for a substring.
|
||||
* Uses GetSpacing from aBreakProvider.
|
||||
* @param aTightBoundingBox if true, we make the bounding box tight
|
||||
* @param aBoundingBoxType which kind of bounding box (loose/tight)
|
||||
*/
|
||||
Metrics MeasureText(PRUint32 aStart, PRUint32 aLength,
|
||||
PRBool aTightBoundingBox,
|
||||
gfxFont::BoundingBoxType aBoundingBoxType,
|
||||
gfxContext *aRefContextForTightBoundingBox,
|
||||
PropertyProvider *aProvider);
|
||||
|
||||
@ -1032,9 +1059,9 @@ public:
|
||||
* Trimmed spaces are still counted in the "characters fit" result.
|
||||
* @param aMetrics if non-null, we fill this in for the returned substring.
|
||||
* If a hyphenation break was used, the hyphen is NOT included in the returned metrics.
|
||||
* @param aTightBoundingBox if true, we make the bounding box in aMetrics tight
|
||||
* @param aBoundingBoxType whether to make the bounding box in aMetrics tight
|
||||
* @param aRefContextForTightBoundingBox a reference context to get the
|
||||
* tight bounding box, if aTightBoundingBox is true
|
||||
* tight bounding box, if requested
|
||||
* @param aUsedHyphenation if non-null, records if we selected a hyphenation break
|
||||
* @param aLastBreak if non-null and result is aMaxLength, we set this to
|
||||
* the maximal N such that
|
||||
@ -1059,7 +1086,8 @@ public:
|
||||
PropertyProvider *aProvider,
|
||||
PRBool aSuppressInitialBreak,
|
||||
gfxFloat *aTrimWhitespace,
|
||||
Metrics *aMetrics, PRBool aTightBoundingBox,
|
||||
Metrics *aMetrics,
|
||||
gfxFont::BoundingBoxType aBoundingBoxType,
|
||||
gfxContext *aRefContextForTightBoundingBox,
|
||||
PRBool *aUsedHyphenation,
|
||||
PRUint32 *aLastBreak,
|
||||
@ -1363,7 +1391,7 @@ public:
|
||||
|
||||
/**
|
||||
* Prefetch all the glyph extents needed to ensure that Measure calls
|
||||
* on this textrun with aTightBoundingBox false will succeed. Note
|
||||
* on this textrun not requesting tight boundingBoxes will succeed. Note
|
||||
* that some glyph extents might not be fetched due to OOM or other
|
||||
* errors.
|
||||
*/
|
||||
@ -1473,14 +1501,15 @@ private:
|
||||
// result in appunits
|
||||
gfxFloat GetPartialLigatureWidth(PRUint32 aStart, PRUint32 aEnd, PropertyProvider *aProvider);
|
||||
void AccumulatePartialLigatureMetrics(gfxFont *aFont,
|
||||
PRUint32 aStart, PRUint32 aEnd, PRBool aTight,
|
||||
PRUint32 aStart, PRUint32 aEnd,
|
||||
gfxFont::BoundingBoxType aBoundingBoxType,
|
||||
gfxContext *aRefContext,
|
||||
PropertyProvider *aProvider,
|
||||
Metrics *aMetrics);
|
||||
|
||||
// **** measurement helper ****
|
||||
void AccumulateMetricsForRun(gfxFont *aFont, PRUint32 aStart,
|
||||
PRUint32 aEnd, PRBool aTight,
|
||||
void AccumulateMetricsForRun(gfxFont *aFont, PRUint32 aStart, PRUint32 aEnd,
|
||||
gfxFont::BoundingBoxType aBoundingBoxType,
|
||||
gfxContext *aRefContext,
|
||||
PropertyProvider *aProvider,
|
||||
PRUint32 aSpacingStart, PRUint32 aSpacingEnd,
|
||||
|
@ -287,7 +287,8 @@ public:
|
||||
|
||||
class gfxWindowsFont : public gfxFont {
|
||||
public:
|
||||
gfxWindowsFont(FontEntry *aFontEntry, const gfxFontStyle *aFontStyle);
|
||||
gfxWindowsFont(FontEntry *aFontEntry, const gfxFontStyle *aFontStyle,
|
||||
cairo_antialias_t anAntialiasOption = CAIRO_ANTIALIAS_DEFAULT);
|
||||
virtual ~gfxWindowsFont();
|
||||
|
||||
virtual const gfxFont::Metrics& GetMetrics();
|
||||
@ -304,6 +305,12 @@ public:
|
||||
gfxContext *aContext, PRBool aDrawToPath, gfxPoint *aBaselineOrigin,
|
||||
Spacing *aSpacing);
|
||||
|
||||
virtual RunMetrics Measure(gfxTextRun *aTextRun,
|
||||
PRUint32 aStart, PRUint32 aEnd,
|
||||
BoundingBoxType aBoundingBoxType,
|
||||
gfxContext *aContextForTightBoundingBox,
|
||||
Spacing *aSpacing);
|
||||
|
||||
virtual PRUint32 GetSpaceGlyph() {
|
||||
GetMetrics(); // ensure that the metrics are computed but don't recompute them
|
||||
return mSpaceGlyph;
|
||||
@ -335,6 +342,8 @@ private:
|
||||
|
||||
LOGFONTW mLogFont;
|
||||
|
||||
cairo_antialias_t mAntialiasOption;
|
||||
|
||||
virtual PRBool SetupCairoFont(gfxContext *aContext);
|
||||
};
|
||||
|
||||
|
@ -502,7 +502,7 @@ NeedsGlyphExtents(gfxTextRun *aTextRun)
|
||||
gfxFont::RunMetrics
|
||||
gfxFont::Measure(gfxTextRun *aTextRun,
|
||||
PRUint32 aStart, PRUint32 aEnd,
|
||||
PRBool aTightBoundingBox, gfxContext *aRefContext,
|
||||
BoundingBoxType aBoundingBoxType, gfxContext *aRefContext,
|
||||
Spacing *aSpacing)
|
||||
{
|
||||
const PRUint32 appUnitsPerDevUnit = aTextRun->GetAppUnitsPerDevUnit();
|
||||
@ -523,7 +523,9 @@ gfxFont::Measure(gfxTextRun *aTextRun,
|
||||
PRBool isRTL = aTextRun->IsRightToLeft();
|
||||
double direction = aTextRun->GetDirection();
|
||||
gfxGlyphExtents *extents =
|
||||
(!aTightBoundingBox && !NeedsGlyphExtents(aTextRun) && !aTextRun->HasDetailedGlyphs()) ? nsnull
|
||||
(aBoundingBoxType == LOOSE_INK_EXTENTS &&
|
||||
!NeedsGlyphExtents(aTextRun) &&
|
||||
!aTextRun->HasDetailedGlyphs()) ? nsnull
|
||||
: GetOrCreateGlyphExtents(aTextRun->GetAppUnitsPerDevUnit());
|
||||
double x = 0;
|
||||
if (aSpacing) {
|
||||
@ -536,10 +538,12 @@ gfxFont::Measure(gfxTextRun *aTextRun,
|
||||
double advance = glyphData->GetSimpleAdvance();
|
||||
// Only get the real glyph horizontal extent if we were asked
|
||||
// for the tight bounding box or we're in quality mode
|
||||
if ((aTightBoundingBox || NeedsGlyphExtents(aTextRun)) && extents) {
|
||||
if ((aBoundingBoxType != LOOSE_INK_EXTENTS ||
|
||||
NeedsGlyphExtents(aTextRun)) && extents) {
|
||||
PRUint32 glyphIndex = glyphData->GetSimpleGlyph();
|
||||
PRUint16 extentsWidth = extents->GetContainedGlyphWidthAppUnits(glyphIndex);
|
||||
if (extentsWidth != gfxGlyphExtents::INVALID_WIDTH && !aTightBoundingBox) {
|
||||
if (extentsWidth != gfxGlyphExtents::INVALID_WIDTH &&
|
||||
aBoundingBoxType == LOOSE_INK_EXTENTS) {
|
||||
UnionRange(x, &advanceMin, &advanceMax);
|
||||
UnionRange(x + direction*extentsWidth, &advanceMin, &advanceMax);
|
||||
} else {
|
||||
@ -592,7 +596,7 @@ gfxFont::Measure(gfxTextRun *aTextRun,
|
||||
}
|
||||
}
|
||||
|
||||
if (!aTightBoundingBox) {
|
||||
if (aBoundingBoxType == LOOSE_INK_EXTENTS) {
|
||||
UnionRange(x, &advanceMin, &advanceMax);
|
||||
gfxRect fontBox(advanceMin, -metrics.mAscent,
|
||||
advanceMax - advanceMin, metrics.mAscent + metrics.mDescent);
|
||||
@ -1791,7 +1795,8 @@ gfxTextRun::Draw(gfxContext *aContext, gfxPoint aPt,
|
||||
if (HasNonOpaqueColor(aContext, currentColor) && HasSyntheticBold(this, aStart, aLength)) {
|
||||
needToRestore = PR_TRUE;
|
||||
// measure text, use the bounding box
|
||||
gfxTextRun::Metrics metrics = MeasureText(aStart, aLength, PR_FALSE, aContext, aProvider);
|
||||
gfxTextRun::Metrics metrics = MeasureText(aStart, aLength, gfxFont::LOOSE_INK_EXTENTS,
|
||||
aContext, aProvider);
|
||||
metrics.mBoundingBox.MoveBy(aPt);
|
||||
syntheticBoldBuffer.PushSolidColor(metrics.mBoundingBox, currentColor, GetAppUnitsPerDevUnit());
|
||||
}
|
||||
@ -1856,7 +1861,8 @@ gfxTextRun::DrawToPath(gfxContext *aContext, gfxPoint aPt,
|
||||
void
|
||||
gfxTextRun::AccumulateMetricsForRun(gfxFont *aFont,
|
||||
PRUint32 aStart, PRUint32 aEnd,
|
||||
PRBool aTight, gfxContext *aRefContext,
|
||||
gfxFont::BoundingBoxType aBoundingBoxType,
|
||||
gfxContext *aRefContext,
|
||||
PropertyProvider *aProvider,
|
||||
PRUint32 aSpacingStart, PRUint32 aSpacingEnd,
|
||||
Metrics *aMetrics)
|
||||
@ -1864,14 +1870,15 @@ gfxTextRun::AccumulateMetricsForRun(gfxFont *aFont,
|
||||
nsAutoTArray<PropertyProvider::Spacing,200> spacingBuffer;
|
||||
PRBool haveSpacing = GetAdjustedSpacingArray(aStart, aEnd, aProvider,
|
||||
aSpacingStart, aSpacingEnd, &spacingBuffer);
|
||||
Metrics metrics = aFont->Measure(this, aStart, aEnd, aTight, aRefContext,
|
||||
Metrics metrics = aFont->Measure(this, aStart, aEnd, aBoundingBoxType, aRefContext,
|
||||
haveSpacing ? spacingBuffer.Elements() : nsnull);
|
||||
aMetrics->CombineWith(metrics, IsRightToLeft());
|
||||
}
|
||||
|
||||
void
|
||||
gfxTextRun::AccumulatePartialLigatureMetrics(gfxFont *aFont,
|
||||
PRUint32 aStart, PRUint32 aEnd, PRBool aTight, gfxContext *aRefContext,
|
||||
PRUint32 aStart, PRUint32 aEnd,
|
||||
gfxFont::BoundingBoxType aBoundingBoxType, gfxContext *aRefContext,
|
||||
PropertyProvider *aProvider, Metrics *aMetrics)
|
||||
{
|
||||
if (aStart >= aEnd)
|
||||
@ -1884,7 +1891,8 @@ gfxTextRun::AccumulatePartialLigatureMetrics(gfxFont *aFont,
|
||||
// First measure the complete ligature
|
||||
Metrics metrics;
|
||||
AccumulateMetricsForRun(aFont, data.mLigatureStart, data.mLigatureEnd,
|
||||
aTight, aRefContext, aProvider, aStart, aEnd, &metrics);
|
||||
aBoundingBoxType, aRefContext,
|
||||
aProvider, aStart, aEnd, &metrics);
|
||||
|
||||
// Clip the bounding box to the ligature part
|
||||
gfxFloat bboxLeft = metrics.mBoundingBox.X();
|
||||
@ -1907,7 +1915,8 @@ gfxTextRun::AccumulatePartialLigatureMetrics(gfxFont *aFont,
|
||||
|
||||
gfxTextRun::Metrics
|
||||
gfxTextRun::MeasureText(PRUint32 aStart, PRUint32 aLength,
|
||||
PRBool aTightBoundingBox, gfxContext *aRefContext,
|
||||
gfxFont::BoundingBoxType aBoundingBoxType,
|
||||
gfxContext *aRefContext,
|
||||
PropertyProvider *aProvider)
|
||||
{
|
||||
NS_ASSERTION(aStart + aLength <= mCharacterCount, "Substring out of range");
|
||||
@ -1923,20 +1932,20 @@ gfxTextRun::MeasureText(PRUint32 aStart, PRUint32 aLength,
|
||||
ShrinkToLigatureBoundaries(&ligatureRunStart, &ligatureRunEnd);
|
||||
|
||||
AccumulatePartialLigatureMetrics(font, start, ligatureRunStart,
|
||||
aTightBoundingBox, aRefContext, aProvider, &accumulatedMetrics);
|
||||
aBoundingBoxType, aRefContext, aProvider, &accumulatedMetrics);
|
||||
|
||||
// XXX This sucks. We have to get glyph extents just so we can detect
|
||||
// glyphs outside the font box, even when aTightBoundingBox is false,
|
||||
// glyphs outside the font box, even when aBoundingBoxType is LOOSE,
|
||||
// even though in almost all cases we could get correct results just
|
||||
// by getting some ascent/descent from the font and using our stored
|
||||
// advance widths.
|
||||
AccumulateMetricsForRun(font,
|
||||
ligatureRunStart, ligatureRunEnd, aTightBoundingBox,
|
||||
ligatureRunStart, ligatureRunEnd, aBoundingBoxType,
|
||||
aRefContext, aProvider, ligatureRunStart, ligatureRunEnd,
|
||||
&accumulatedMetrics);
|
||||
|
||||
AccumulatePartialLigatureMetrics(font, ligatureRunEnd, end,
|
||||
aTightBoundingBox, aRefContext, aProvider, &accumulatedMetrics);
|
||||
aBoundingBoxType, aRefContext, aProvider, &accumulatedMetrics);
|
||||
}
|
||||
|
||||
return accumulatedMetrics;
|
||||
@ -1950,7 +1959,8 @@ gfxTextRun::BreakAndMeasureText(PRUint32 aStart, PRUint32 aMaxLength,
|
||||
PropertyProvider *aProvider,
|
||||
PRBool aSuppressInitialBreak,
|
||||
gfxFloat *aTrimWhitespace,
|
||||
Metrics *aMetrics, PRBool aTightBoundingBox,
|
||||
Metrics *aMetrics,
|
||||
gfxFont::BoundingBoxType aBoundingBoxType,
|
||||
gfxContext *aRefContext,
|
||||
PRBool *aUsedHyphenation,
|
||||
PRUint32 *aLastBreak,
|
||||
@ -2090,7 +2100,7 @@ gfxTextRun::BreakAndMeasureText(PRUint32 aStart, PRUint32 aMaxLength,
|
||||
|
||||
if (aMetrics) {
|
||||
*aMetrics = MeasureText(aStart, charsFit - trimmableChars,
|
||||
aTightBoundingBox, aRefContext, aProvider);
|
||||
aBoundingBoxType, aRefContext, aProvider);
|
||||
}
|
||||
if (aTrimWhitespace) {
|
||||
*aTrimWhitespace = trimmableAdvance;
|
||||
|
@ -738,11 +738,12 @@ FontEntry::TestCharacterMap(PRUint32 aCh)
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
gfxWindowsFont::gfxWindowsFont(FontEntry *aFontEntry, const gfxFontStyle *aFontStyle)
|
||||
gfxWindowsFont::gfxWindowsFont(FontEntry *aFontEntry, const gfxFontStyle *aFontStyle,
|
||||
cairo_antialias_t anAntialiasOption)
|
||||
: gfxFont(aFontEntry, aFontStyle),
|
||||
mFont(nsnull), mAdjustedSize(0.0), mScriptCache(nsnull),
|
||||
mFontFace(nsnull), mScaledFont(nsnull),
|
||||
mMetrics(nsnull)
|
||||
mMetrics(nsnull), mAntialiasOption(anAntialiasOption)
|
||||
{
|
||||
mFontEntry = aFontEntry;
|
||||
NS_ASSERTION(mFontEntry, "Unable to find font entry for font. Something is whack.");
|
||||
@ -798,6 +799,9 @@ gfxWindowsFont::CairoScaledFont()
|
||||
cairo_matrix_init_identity(&identityMatrix);
|
||||
|
||||
cairo_font_options_t *fontOptions = cairo_font_options_create();
|
||||
if (mAntialiasOption != CAIRO_ANTIALIAS_DEFAULT) {
|
||||
cairo_font_options_set_antialias(fontOptions, mAntialiasOption);
|
||||
}
|
||||
mScaledFont = cairo_scaled_font_create(CairoFontFace(), &sizeMatrix,
|
||||
&identityMatrix, fontOptions);
|
||||
cairo_font_options_destroy(fontOptions);
|
||||
@ -999,6 +1003,31 @@ gfxWindowsFont::Draw(gfxTextRun *aTextRun, PRUint32 aStart, PRUint32 aEnd,
|
||||
aSpacing);
|
||||
}
|
||||
|
||||
gfxFont::RunMetrics
|
||||
gfxWindowsFont::Measure(gfxTextRun *aTextRun,
|
||||
PRUint32 aStart, PRUint32 aEnd,
|
||||
BoundingBoxType aBoundingBoxType,
|
||||
gfxContext *aRefContext,
|
||||
Spacing *aSpacing)
|
||||
{
|
||||
// if aBoundingBoxType is TIGHT_HINTED_OUTLINE_EXTENTS
|
||||
// and the underlying cairo font may be antialiased,
|
||||
// we need to create a copy in order to avoid getting cached extents
|
||||
if (aBoundingBoxType == TIGHT_HINTED_OUTLINE_EXTENTS &&
|
||||
mAntialiasOption != CAIRO_ANTIALIAS_NONE) {
|
||||
nsRefPtr<gfxWindowsFont> tempFont =
|
||||
new gfxWindowsFont(GetFontEntry(), GetStyle(), CAIRO_ANTIALIAS_NONE);
|
||||
if (tempFont) {
|
||||
return tempFont->Measure(aTextRun, aStart, aEnd,
|
||||
TIGHT_HINTED_OUTLINE_EXTENTS,
|
||||
aRefContext, aSpacing);
|
||||
}
|
||||
}
|
||||
|
||||
return gfxFont::Measure(aTextRun, aStart, aEnd,
|
||||
aBoundingBoxType, aRefContext, aSpacing);
|
||||
}
|
||||
|
||||
FontEntry*
|
||||
gfxWindowsFont::GetFontEntry()
|
||||
{
|
||||
|
@ -1199,7 +1199,16 @@ XPCNativeWrapper::GetNewOrUsed(JSContext *cx, XPCWrappedNative *wrapper,
|
||||
nsCOMPtr<nsIXPConnectWrappedJS> xpcwrappedjs(do_QueryWrappedNative(wrapper));
|
||||
|
||||
if (xpcwrappedjs) {
|
||||
XPCThrower::Throw(NS_ERROR_INVALID_ARG, cx);
|
||||
JSObject *flat = wrapper->GetFlatJSObject();
|
||||
jsval v = OBJECT_TO_JSVAL(flat);
|
||||
|
||||
XPCCallContext ccx(JS_CALLER, cx);
|
||||
|
||||
// Make sure v doesn't get collected while we're re-wrapping it.
|
||||
AUTO_MARK_JSVAL(ccx, v);
|
||||
|
||||
if (XPC_SJOW_Construct(cx, nsnull, 1, &v, &v))
|
||||
return JSVAL_TO_OBJECT(v);
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -1936,6 +1936,10 @@ DrawBorderImage(nsPresContext* aPresContext,
|
||||
split.bottom,
|
||||
};
|
||||
|
||||
// In all the 'factor' calculations below, 'border' measurements are
|
||||
// in app units but 'split' measurements are in image/CSS pixels, so
|
||||
// the factor corresponding to no additional scaling is
|
||||
// CSSPixelsToAppUnits(1), not simply 1.
|
||||
for (int i = LEFT; i <= RIGHT; i++) {
|
||||
for (int j = TOP; j <= BOTTOM; j++) {
|
||||
nsRect destArea(borderX[i], borderY[j], borderWidth[i], borderHeight[j]);
|
||||
@ -1946,14 +1950,14 @@ DrawBorderImage(nsPresContext* aPresContext,
|
||||
|
||||
if (i == MIDDLE && j == MIDDLE) {
|
||||
// css-background:
|
||||
// The middle image's width is scaled by the same factor as
|
||||
// the top image unless that factor is zero or infinity, in
|
||||
// which case the scaling factor of the bottom is substituted,
|
||||
// and failing that, the width is not scaled. The height of
|
||||
// the middle image is scaled by the same factor as the left
|
||||
// image unless that factor is zero or infinity, in which case
|
||||
// the scaling factor of the right image is substituted, and
|
||||
// failing that, the height is not scaled.
|
||||
// The middle image's width is scaled by the same factor as the
|
||||
// top image unless that factor is zero or infinity, in which
|
||||
// case the scaling factor of the bottom is substituted, and
|
||||
// failing that, the width is not scaled. The height of the
|
||||
// middle image is scaled by the same factor as the left image
|
||||
// unless that factor is zero or infinity, in which case the
|
||||
// scaling factor of the right image is substituted, and failing
|
||||
// that, the height is not scaled.
|
||||
gfxFloat hFactor, vFactor;
|
||||
|
||||
if (0 < border.left && 0 < split.left)
|
||||
@ -1961,14 +1965,14 @@ DrawBorderImage(nsPresContext* aPresContext,
|
||||
else if (0 < border.right && 0 < split.right)
|
||||
vFactor = gfxFloat(border.right)/split.right;
|
||||
else
|
||||
vFactor = 1.0;
|
||||
vFactor = nsPresContext::CSSPixelsToAppUnits(1);
|
||||
|
||||
if (0 < border.top && 0 < split.top)
|
||||
hFactor = gfxFloat(border.top)/split.top;
|
||||
else if (0 < border.bottom && 0 < split.bottom)
|
||||
hFactor = gfxFloat(border.bottom)/split.bottom;
|
||||
else
|
||||
hFactor = 1.0;
|
||||
hFactor = nsPresContext::CSSPixelsToAppUnits(1);
|
||||
|
||||
unitSize.width = splitWidth[i]*hFactor;
|
||||
unitSize.height = splitHeight[j]*vFactor;
|
||||
@ -1978,9 +1982,11 @@ DrawBorderImage(nsPresContext* aPresContext,
|
||||
} else if (i == MIDDLE) { // top, bottom
|
||||
// Sides are always stretched to the thickness of their border,
|
||||
// and stretched proportionately on the other axis.
|
||||
gfxFloat factor = 1.0;
|
||||
gfxFloat factor;
|
||||
if (0 < borderHeight[j] && 0 < splitHeight[j])
|
||||
factor = gfxFloat(borderHeight[j])/splitHeight[j];
|
||||
else
|
||||
factor = nsPresContext::CSSPixelsToAppUnits(1);
|
||||
|
||||
unitSize.width = splitWidth[i]*factor;
|
||||
unitSize.height = borderHeight[j];
|
||||
@ -1988,9 +1994,11 @@ DrawBorderImage(nsPresContext* aPresContext,
|
||||
fillStyleV = NS_STYLE_BORDER_IMAGE_STRETCH;
|
||||
|
||||
} else if (j == MIDDLE) { // left, right
|
||||
gfxFloat factor = 1.0;
|
||||
gfxFloat factor;
|
||||
if (0 < borderWidth[i] && 0 < splitWidth[i])
|
||||
factor = gfxFloat(borderWidth[i])/splitWidth[i];
|
||||
else
|
||||
factor = nsPresContext::CSSPixelsToAppUnits(1);
|
||||
|
||||
unitSize.width = borderWidth[i];
|
||||
unitSize.height = splitHeight[j]*factor;
|
||||
|
@ -1015,7 +1015,7 @@ PRBool nsCaret::IsMenuPopupHidingCaret()
|
||||
#ifdef MOZ_XUL
|
||||
// Check if there are open popups.
|
||||
nsXULPopupManager *popMgr = nsXULPopupManager::GetInstance();
|
||||
nsTArray<nsIFrame*> popups = popMgr->GetOpenPopups();
|
||||
nsTArray<nsIFrame*> popups = popMgr->GetVisiblePopups();
|
||||
|
||||
if (popups.Length() == 0)
|
||||
return PR_FALSE; // No popups, so caret can't be hidden by them.
|
||||
|
@ -2226,7 +2226,7 @@ DocumentViewerImpl::MakeWindow(const nsSize& aSize)
|
||||
if (container) {
|
||||
container->GetSameTypeParent(getter_AddRefs(sameTypeParent));
|
||||
}
|
||||
if (!sameTypeParent) {
|
||||
if (!sameTypeParent && mParentWidget->GetTransparencyMode() != eTransparencyTransparent) {
|
||||
containerView = nsnull;
|
||||
}
|
||||
}
|
||||
|
@ -5662,7 +5662,7 @@ PresShell::HandleEvent(nsIView *aView,
|
||||
#ifdef MOZ_XUL
|
||||
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
|
||||
if (pm) {
|
||||
nsTArray<nsIFrame*> popups = pm->GetOpenPopups();
|
||||
nsTArray<nsIFrame*> popups = pm->GetVisiblePopups();
|
||||
PRUint32 i;
|
||||
// Search from top to bottom
|
||||
for (i = 0; i < popups.Length(); i++) {
|
||||
|
20
layout/generic/crashtests/472776-1.html
Normal file
20
layout/generic/crashtests/472776-1.html
Normal file
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script type="text/javascript">
|
||||
|
||||
function boom()
|
||||
{
|
||||
var v = document.getElementById("v");
|
||||
v.childNodes[1].firstChild.data = "";
|
||||
document.documentElement.offsetHeight;
|
||||
v.appendChild(document.createTextNode("D"));
|
||||
v.removeChild(v.firstChild);
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="boom();">
|
||||
<div id="v"><span>A</span><span>یC</span></div>
|
||||
</body>
|
||||
</html>
|
@ -193,5 +193,6 @@ load 463741-1.html
|
||||
load 465651-1.html
|
||||
load 467487-1.html
|
||||
load 468207-1.html
|
||||
load 472776-1.html
|
||||
load 472950-1.html
|
||||
load 477928.html
|
||||
|
@ -1596,11 +1596,6 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
|
||||
|
||||
TextRunMappedFlow* newFlow = &userData->mMappedFlows[i];
|
||||
newFlow->mStartFrame = mappedFlow->mStartFrame;
|
||||
if (!mSkipIncompleteTextRuns) {
|
||||
// If mSkipIncompleteTextRuns is set, then we're just going to
|
||||
// throw away the userData.
|
||||
newFlow->mStartFrame->AddStateBits(TEXT_IN_TEXTRUN_USER_DATA);
|
||||
}
|
||||
newFlow->mDOMOffsetToBeforeTransformOffset = builder.GetCharCount() -
|
||||
mappedFlow->mStartFrame->GetContentOffset();
|
||||
newFlow->mContentLength = contentLength;
|
||||
@ -1950,6 +1945,9 @@ BuildTextRunsScanner::AssignTextRun(gfxTextRun* aTextRun)
|
||||
f->ClearTextRun();
|
||||
f->SetTextRun(aTextRun);
|
||||
}
|
||||
// Set this bit now; we can't set it any earlier because
|
||||
// f->ClearTextRun() might clear it out.
|
||||
startFrame->AddStateBits(TEXT_IN_TEXTRUN_USER_DATA);
|
||||
// BuildTextRunForFrames mashes together mapped flows for the same element,
|
||||
// so we do that here too.
|
||||
lastContent = startFrame->GetContent();
|
||||
@ -4203,7 +4201,8 @@ PRBool SelectionIterator::GetNextSegment(gfxFloat* aXOffset,
|
||||
|
||||
static void
|
||||
AddHyphenToMetrics(nsTextFrame* aTextFrame, gfxTextRun* aBaseTextRun,
|
||||
gfxTextRun::Metrics* aMetrics, PRBool aTightBoundingBox,
|
||||
gfxTextRun::Metrics* aMetrics,
|
||||
gfxFont::BoundingBoxType aBoundingBoxType,
|
||||
gfxContext* aContext)
|
||||
{
|
||||
// Fix up metrics to include hyphen
|
||||
@ -4213,7 +4212,8 @@ AddHyphenToMetrics(nsTextFrame* aTextFrame, gfxTextRun* aBaseTextRun,
|
||||
return;
|
||||
|
||||
gfxTextRun::Metrics hyphenMetrics =
|
||||
hyphenTextRun->MeasureText(0, hyphenTextRun->GetLength(), aTightBoundingBox, aContext, nsnull);
|
||||
hyphenTextRun->MeasureText(0, hyphenTextRun->GetLength(),
|
||||
aBoundingBoxType, aContext, nsnull);
|
||||
aMetrics->CombineWith(hyphenMetrics, aBaseTextRun->IsRightToLeft());
|
||||
}
|
||||
|
||||
@ -4228,10 +4228,10 @@ nsTextFrame::PaintOneShadow(PRUint32 aOffset, PRUint32 aLength,
|
||||
nscoord blurRadius = PR_MAX(aShadowDetails->mRadius, 0);
|
||||
|
||||
gfxTextRun::Metrics shadowMetrics =
|
||||
mTextRun->MeasureText(aOffset, aLength, PR_FALSE,
|
||||
mTextRun->MeasureText(aOffset, aLength, gfxFont::LOOSE_INK_EXTENTS,
|
||||
nsnull, aProvider);
|
||||
if (GetStateBits() & TEXT_HYPHEN_BREAK) {
|
||||
AddHyphenToMetrics(this, mTextRun, &shadowMetrics, PR_FALSE, aCtx);
|
||||
AddHyphenToMetrics(this, mTextRun, &shadowMetrics, gfxFont::LOOSE_INK_EXTENTS, aCtx);
|
||||
}
|
||||
|
||||
// This rect is the box which is equivalent to where the shadow will be painted.
|
||||
@ -5660,24 +5660,14 @@ nsTextFrame::ComputeTightBounds(gfxContext* aContext) const
|
||||
|
||||
gfxTextRun::Metrics metrics =
|
||||
mTextRun->MeasureText(provider.GetStart().GetSkippedOffset(),
|
||||
ComputeTransformedLength(provider), PR_TRUE,
|
||||
ComputeTransformedLength(provider),
|
||||
gfxFont::TIGHT_HINTED_OUTLINE_EXTENTS,
|
||||
aContext, &provider);
|
||||
// mAscent should be the same as metrics.mAscent, but it's what we use to
|
||||
// paint so that's the one we'll use.
|
||||
return RoundOut(metrics.mBoundingBox) + nsPoint(0, mAscent);
|
||||
}
|
||||
|
||||
static void
|
||||
AddCharToMetrics(gfxTextRun* aCharTextRun, gfxTextRun* aBaseTextRun,
|
||||
gfxTextRun::Metrics* aMetrics, PRBool aTightBoundingBox,
|
||||
gfxContext* aContext)
|
||||
{
|
||||
gfxTextRun::Metrics charMetrics =
|
||||
aCharTextRun->MeasureText(0, aCharTextRun->GetLength(), aTightBoundingBox, aContext, nsnull);
|
||||
|
||||
aMetrics->CombineWith(charMetrics, aBaseTextRun->IsRightToLeft());
|
||||
}
|
||||
|
||||
static PRBool
|
||||
HasSoftHyphenBefore(const nsTextFragment* aFrag, gfxTextRun* aTextRun,
|
||||
PRInt32 aStartOffset, const gfxSkipCharsIterator& aIter)
|
||||
@ -5923,7 +5913,9 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
|
||||
|
||||
// The metrics for the text go in here
|
||||
gfxTextRun::Metrics textMetrics;
|
||||
PRBool needTightBoundingBox = IsFloatingFirstLetterChild();
|
||||
gfxFont::BoundingBoxType boundingBoxType = IsFloatingFirstLetterChild() ?
|
||||
gfxFont::TIGHT_HINTED_OUTLINE_EXTENTS :
|
||||
gfxFont::LOOSE_INK_EXTENTS;
|
||||
#ifdef MOZ_MATHML
|
||||
NS_ASSERTION(!(NS_REFLOW_CALC_BOUNDING_METRICS & aMetrics.mFlags),
|
||||
"We shouldn't be passed NS_REFLOW_CALC_BOUNDING_METRICS anymore");
|
||||
@ -5971,7 +5963,7 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
|
||||
availWidth,
|
||||
&provider, !lineLayout.LineIsBreakable(),
|
||||
canTrimTrailingWhitespace ? &trimmedWidth : nsnull,
|
||||
&textMetrics, needTightBoundingBox, ctx,
|
||||
&textMetrics, boundingBoxType, ctx,
|
||||
&usedHyphenation, &transformedLastBreak,
|
||||
textStyle->WordCanWrap(), &breakPriority);
|
||||
// The "end" iterator points to the first character after the string mapped
|
||||
@ -6008,7 +6000,7 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
|
||||
}
|
||||
if (usedHyphenation) {
|
||||
// Fix up metrics to include hyphen
|
||||
AddHyphenToMetrics(this, mTextRun, &textMetrics, needTightBoundingBox, ctx);
|
||||
AddHyphenToMetrics(this, mTextRun, &textMetrics, boundingBoxType, ctx);
|
||||
AddStateBits(TEXT_HYPHEN_BREAK | TEXT_HAS_NONCOLLAPSED_CHARACTERS);
|
||||
}
|
||||
|
||||
@ -6068,7 +6060,7 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
|
||||
if (transformedCharsFit == 0 && !usedHyphenation) {
|
||||
aMetrics.ascent = 0;
|
||||
aMetrics.height = 0;
|
||||
} else if (needTightBoundingBox) {
|
||||
} else if (boundingBoxType != gfxFont::LOOSE_INK_EXTENTS) {
|
||||
// Use actual text metrics for floating first letter frame.
|
||||
aMetrics.ascent = NSToCoordCeil(textMetrics.mAscent);
|
||||
aMetrics.height = aMetrics.ascent + NSToCoordCeil(textMetrics.mDescent);
|
||||
@ -6305,7 +6297,8 @@ nsTextFrame::RecomputeOverflowRect()
|
||||
|
||||
gfxTextRun::Metrics textMetrics =
|
||||
mTextRun->MeasureText(provider.GetStart().GetSkippedOffset(),
|
||||
ComputeTransformedLength(provider), PR_FALSE, nsnull,
|
||||
ComputeTransformedLength(provider),
|
||||
gfxFont::LOOSE_INK_EXTENTS, nsnull,
|
||||
&provider);
|
||||
|
||||
nsRect boundingBox = RoundOut(textMetrics.mBoundingBox) + nsPoint(0, mAscent);
|
||||
|
54
layout/reftests/border-image/center-scaling-4b-ref.html
Normal file
54
layout/reftests/border-image/center-scaling-4b-ref.html
Normal file
@ -0,0 +1,54 @@
|
||||
<!doctype html>
|
||||
<style>div { line-height: 0 }</style>
|
||||
<body
|
||||
><div><img src="reticule-tl.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-tr.png" width="27" height="27"></div
|
||||
><div><img src="reticule-le.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ri.png" width="27" height="27"></div
|
||||
><div><img src="reticule-le.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ri.png" width="27" height="27"></div
|
||||
><div><img src="reticule-le.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ri.png" width="27" height="27"></div
|
||||
><div><img src="reticule-le.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ri.png" width="27" height="27"></div
|
||||
></body>
|
10
layout/reftests/border-image/center-scaling-4b.html
Normal file
10
layout/reftests/border-image/center-scaling-4b.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!doctype html>
|
||||
<style>
|
||||
div {
|
||||
border-width: 27px 27px 0 27px;
|
||||
-moz-border-image: url("reticule.png") 27 round;
|
||||
width: 216px;
|
||||
height: 108px;
|
||||
}
|
||||
</style>
|
||||
<div></div>
|
58
layout/reftests/border-image/center-scaling-4l-ref.html
Normal file
58
layout/reftests/border-image/center-scaling-4l-ref.html
Normal file
@ -0,0 +1,58 @@
|
||||
<!doctype html>
|
||||
<style>div { line-height: 0 }</style>
|
||||
<body
|
||||
><div><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-tr.png" width="27" height="27"></div
|
||||
><div><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ri.png" width="27" height="27"></div
|
||||
><div><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ri.png" width="27" height="27"></div
|
||||
><div><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ri.png" width="27" height="27"></div
|
||||
><div><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ri.png" width="27" height="27"></div
|
||||
><div><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-br.png" width="27" height="27"></div
|
||||
></body>
|
10
layout/reftests/border-image/center-scaling-4l.html
Normal file
10
layout/reftests/border-image/center-scaling-4l.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!doctype html>
|
||||
<style>
|
||||
div {
|
||||
border-width: 27px 27px 27px 0;
|
||||
-moz-border-image: url("reticule.png") 27 round;
|
||||
width: 216px;
|
||||
height: 108px;
|
||||
}
|
||||
</style>
|
||||
<div></div>
|
52
layout/reftests/border-image/center-scaling-4lr-ref.html
Normal file
52
layout/reftests/border-image/center-scaling-4lr-ref.html
Normal file
@ -0,0 +1,52 @@
|
||||
<!doctype html>
|
||||
<style>div { line-height: 0 }</style>
|
||||
<body
|
||||
><div><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"></div
|
||||
><div><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"></div
|
||||
><div><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"></div
|
||||
><div><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"></div
|
||||
><div><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"></div
|
||||
><div><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"></div
|
||||
></body>
|
10
layout/reftests/border-image/center-scaling-4lr.html
Normal file
10
layout/reftests/border-image/center-scaling-4lr.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!doctype html>
|
||||
<style>
|
||||
div {
|
||||
border-width: 27px 0 27px 0;
|
||||
-moz-border-image: url("reticule.png") 27 round;
|
||||
width: 216px;
|
||||
height: 108px;
|
||||
}
|
||||
</style>
|
||||
<div></div>
|
58
layout/reftests/border-image/center-scaling-4r-ref.html
Normal file
58
layout/reftests/border-image/center-scaling-4r-ref.html
Normal file
@ -0,0 +1,58 @@
|
||||
<!doctype html>
|
||||
<style>div { line-height: 0 }</style>
|
||||
<body
|
||||
><div><img src="reticule-tl.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"
|
||||
><img src="reticule-to.png" width="27" height="27"></div
|
||||
><div><img src="reticule-le.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"></div
|
||||
><div><img src="reticule-le.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"></div
|
||||
><div><img src="reticule-le.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"></div
|
||||
><div><img src="reticule-le.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"></div
|
||||
><div><img src="reticule-bl.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"></div
|
||||
></body>
|
10
layout/reftests/border-image/center-scaling-4r.html
Normal file
10
layout/reftests/border-image/center-scaling-4r.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!doctype html>
|
||||
<style>
|
||||
div {
|
||||
border-width: 27px 0 27px 27px;
|
||||
-moz-border-image: url("reticule.png") 27 round;
|
||||
width: 216px;
|
||||
height: 108px;
|
||||
}
|
||||
</style>
|
||||
<div></div>
|
54
layout/reftests/border-image/center-scaling-4t-ref.html
Normal file
54
layout/reftests/border-image/center-scaling-4t-ref.html
Normal file
@ -0,0 +1,54 @@
|
||||
<!doctype html>
|
||||
<style>div { line-height: 0 }</style>
|
||||
<body
|
||||
><div><img src="reticule-le.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ri.png" width="27" height="27"></div
|
||||
><div><img src="reticule-le.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ri.png" width="27" height="27"></div
|
||||
><div><img src="reticule-le.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ri.png" width="27" height="27"></div
|
||||
><div><img src="reticule-le.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ri.png" width="27" height="27"></div
|
||||
><div><img src="reticule-bl.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-bo.png" width="27" height="27"
|
||||
><img src="reticule-br.png" width="27" height="27"></div
|
||||
></body>
|
10
layout/reftests/border-image/center-scaling-4t.html
Normal file
10
layout/reftests/border-image/center-scaling-4t.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!doctype html>
|
||||
<style>
|
||||
div {
|
||||
border-width: 0 27px 27px 27px;
|
||||
-moz-border-image: url("reticule.png") 27 round;
|
||||
width: 216px;
|
||||
height: 108px;
|
||||
}
|
||||
</style>
|
||||
<div></div>
|
44
layout/reftests/border-image/center-scaling-4tb-ref.html
Normal file
44
layout/reftests/border-image/center-scaling-4tb-ref.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!doctype html>
|
||||
<style>div { line-height: 0 }</style>
|
||||
<body
|
||||
><div><img src="reticule-le.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ri.png" width="27" height="27"></div
|
||||
><div><img src="reticule-le.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ri.png" width="27" height="27"></div
|
||||
><div><img src="reticule-le.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ri.png" width="27" height="27"></div
|
||||
><div><img src="reticule-le.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ct.png" width="27" height="27"
|
||||
><img src="reticule-ri.png" width="27" height="27"></div
|
||||
></body>
|
10
layout/reftests/border-image/center-scaling-4tb.html
Normal file
10
layout/reftests/border-image/center-scaling-4tb.html
Normal file
@ -0,0 +1,10 @@
|
||||
<!doctype html>
|
||||
<style>
|
||||
div {
|
||||
border-width: 0 27px 0 27px;
|
||||
-moz-border-image: url("reticule.png") 27 round;
|
||||
width: 216px;
|
||||
height: 108px;
|
||||
}
|
||||
</style>
|
||||
<div></div>
|
23
layout/reftests/bugs/249141-ref.xul
Normal file
23
layout/reftests/bugs/249141-ref.xul
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml-stylesheet type="text/css" href="data:text/css,
|
||||
label
|
||||
{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
"?>
|
||||
<window id="window" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<vbox>
|
||||
<hbox><label value="20px **************"/><label crop="end" value="…" style="max-width: 20px; width: 20px; background: lime"/><spacer flex="1"/></hbox>
|
||||
<hbox><label value="19px **************"/><label crop="end" value="…" style="max-width: 19px; width: 19px; background: yellow"/><spacer flex="1"/></hbox>
|
||||
<hbox><label value="18px **************"/><label crop="end" value="…" style="max-width: 18px; width: 18px; background: lime"/><spacer flex="1"/></hbox>
|
||||
<hbox><label value="17px **************"/><label crop="end" value="…" style="max-width: 17px; width: 17px; background: yellow"/><spacer flex="1"/></hbox>
|
||||
<hbox><label value="16px **************"/><label crop="end" value="…" style="max-width: 16px; width: 16px; background: lime"/><spacer flex="1"/></hbox>
|
||||
<hbox><label value="15px **************"/><label crop="end" value="…" style="max-width: 15px; width: 15px; background: yellow"/><spacer flex="1"/></hbox>
|
||||
<hbox><label value="14px **************"/><label crop="end" value="…" style="max-width: 14px; width: 14px; background: lime"/><spacer flex="1"/></hbox>
|
||||
<hbox><label value="13px **************"/><label crop="end" value="…" style="max-width: 13px; width: 13px; background: yellow"/><spacer flex="1"/></hbox>
|
||||
<hbox><label value="12px **************"/><label crop="end" value="…" style="max-width: 12px; width: 12px; background: lime"/><spacer flex="1"/></hbox>
|
||||
<hbox><label value="11px **************"/><label crop="end" value="…" style="max-width: 11px; width: 11px; background: yellow"/><spacer flex="1"/></hbox>
|
||||
<hbox><label value="10px **************"/><label crop="end" value="…" style="max-width: 10px; width: 10px; background: lime"/><spacer flex="1"/></hbox>
|
||||
</vbox>
|
||||
</window>
|
23
layout/reftests/bugs/249141.xul
Normal file
23
layout/reftests/bugs/249141.xul
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml-stylesheet type="text/css" href="data:text/css,
|
||||
label
|
||||
{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
"?>
|
||||
<window id="window" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<vbox>
|
||||
<hbox><label value="20px **************"/><label crop="end" value="**************" style="max-width: 20px; background: lime"/><spacer flex="1"/></hbox>
|
||||
<hbox><label value="19px **************"/><label crop="end" value="**************" style="max-width: 19px; background: yellow"/><spacer flex="1"/></hbox>
|
||||
<hbox><label value="18px **************"/><label crop="end" value="**************" style="max-width: 18px; background: lime"/><spacer flex="1"/></hbox>
|
||||
<hbox><label value="17px **************"/><label crop="end" value="**************" style="max-width: 17px; background: yellow"/><spacer flex="1"/></hbox>
|
||||
<hbox><label value="16px **************"/><label crop="end" value="**************" style="max-width: 16px; background: lime"/><spacer flex="1"/></hbox>
|
||||
<hbox><label value="15px **************"/><label crop="end" value="**************" style="max-width: 15px; background: yellow"/><spacer flex="1"/></hbox>
|
||||
<hbox><label value="14px **************"/><label crop="end" value="**************" style="max-width: 14px; background: lime"/><spacer flex="1"/></hbox>
|
||||
<hbox><label value="13px **************"/><label crop="end" value="**************" style="max-width: 13px; background: yellow"/><spacer flex="1"/></hbox>
|
||||
<hbox><label value="12px **************"/><label crop="end" value="**************" style="max-width: 12px; background: lime"/><spacer flex="1"/></hbox>
|
||||
<hbox><label value="11px **************"/><label crop="end" value="**************" style="max-width: 11px; background: yellow"/><spacer flex="1"/></hbox>
|
||||
<hbox><label value="10px **************"/><label crop="end" value="**************" style="max-width: 10px; background: lime"/><spacer flex="1"/></hbox>
|
||||
</vbox>
|
||||
</window>
|
@ -209,6 +209,7 @@ skip-if(MOZ_WIDGET_TOOLKIT=="cocoa") != 240536-resizer-ltr.xul 240536-resizer-rt
|
||||
== 244135-1.html 244135-1-ref.html
|
||||
== 244135-2.html 244135-2-ref.html
|
||||
== 244932-1.html 244932-1-ref.html
|
||||
== 249141.xul 249141-ref.xul
|
||||
== 249982-1.html 249982-1-ref.html
|
||||
== 252920-1.html 252920-1-ref.html
|
||||
== 253701-1.html 253701-1-ref.html
|
||||
@ -438,7 +439,7 @@ random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 333970-1.html 333970-1-ref.html # bug 3
|
||||
== 352980-3f.html 352980-3-ref.html
|
||||
== 355548-1.xml 355548-1-ref.xml
|
||||
== 355548-2.xml 355548-2-ref.xml
|
||||
== 355548-3.xml 355548-3-ref.xml
|
||||
fails-if(MOZ_WIDGET_TOOLKIT=="windows") == 355548-3.xml 355548-3-ref.xml # see bug 445087
|
||||
== 355548-4.xml 355548-4-ref.xml
|
||||
== 355548-5.xml 355548-5-ref.xml
|
||||
fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == 356774-1.html 356774-1-ref.html # probably bug 379317
|
||||
|
@ -540,7 +540,7 @@ nsSVGGlyphFrame::AddBoundingBoxesToPath(CharacterIterator *aIter,
|
||||
if (aIter->SetupForDirectTextRunMetrics(aContext)) {
|
||||
gfxTextRun::Metrics metrics =
|
||||
mTextRun->MeasureText(0, mTextRun->GetLength(),
|
||||
PR_FALSE, nsnull, nsnull);
|
||||
gfxFont::LOOSE_INK_EXTENTS, nsnull, nsnull);
|
||||
aContext->Rectangle(metrics.mBoundingBox);
|
||||
return;
|
||||
}
|
||||
@ -549,7 +549,7 @@ nsSVGGlyphFrame::AddBoundingBoxesToPath(CharacterIterator *aIter,
|
||||
while ((i = aIter->NextChar()) >= 0) {
|
||||
aIter->SetupForMetrics(aContext);
|
||||
gfxTextRun::Metrics metrics =
|
||||
mTextRun->MeasureText(i, 1, PR_FALSE, nsnull, nsnull);
|
||||
mTextRun->MeasureText(i, 1, gfxFont::LOOSE_INK_EXTENTS, nsnull, nsnull);
|
||||
aContext->Rectangle(metrics.mBoundingBox);
|
||||
}
|
||||
}
|
||||
@ -889,7 +889,8 @@ nsSVGGlyphFrame::GetExtentOfChar(PRUint32 charnum, nsIDOMSVGRect **_retval)
|
||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||
|
||||
gfxTextRun::Metrics metrics =
|
||||
mTextRun->MeasureText(start, limit - start, PR_FALSE, nsnull, nsnull);
|
||||
mTextRun->MeasureText(start, limit - start, gfxFont::LOOSE_INK_EXTENTS,
|
||||
nsnull, nsnull);
|
||||
|
||||
nsRefPtr<gfxContext> tmpCtx = MakeTmpCtx();
|
||||
iter.SetupForMetrics(tmpCtx);
|
||||
@ -927,7 +928,7 @@ nsSVGGlyphFrame::GetBaselineOffset(PRUint16 baselineIdentifier,
|
||||
|
||||
gfxTextRun::Metrics metrics =
|
||||
mTextRun->MeasureText(0, mTextRun->GetLength(),
|
||||
PR_FALSE, nsnull, nsnull);
|
||||
gfxFont::LOOSE_INK_EXTENTS, nsnull, nsnull);
|
||||
|
||||
gfxFloat baselineAppUnits;
|
||||
switch (baselineIdentifier) {
|
||||
@ -1125,7 +1126,8 @@ nsSVGGlyphFrame::GetCharNumAtPosition(nsIDOMSVGPoint *point)
|
||||
++limit;
|
||||
}
|
||||
gfxTextRun::Metrics metrics =
|
||||
mTextRun->MeasureText(i, limit - i, PR_FALSE, nsnull, nsnull);
|
||||
mTextRun->MeasureText(i, limit - i, gfxFont::LOOSE_INK_EXTENTS,
|
||||
nsnull, nsnull);
|
||||
|
||||
// the SVG spec tells us to divide the width of the cluster equally among
|
||||
// its chars, so we'll step through the chars, allocating a share of the
|
||||
@ -1220,7 +1222,7 @@ nsSVGGlyphFrame::ContainsPoint(const nsPoint &aPoint)
|
||||
PRInt32 i;
|
||||
while ((i = iter.NextChar()) >= 0) {
|
||||
gfxTextRun::Metrics metrics =
|
||||
mTextRun->MeasureText(i, 1, PR_FALSE, nsnull, nsnull);
|
||||
mTextRun->MeasureText(i, 1, gfxFont::LOOSE_INK_EXTENTS, nsnull, nsnull);
|
||||
iter.SetupForMetrics(tmpCtx);
|
||||
tmpCtx->Rectangle(metrics.mBoundingBox);
|
||||
}
|
||||
|
@ -498,10 +498,10 @@ public:
|
||||
nsIFrame* GetTopPopup(nsPopupType aType);
|
||||
|
||||
/**
|
||||
* Return an array of all the open popup frames for menus, in order from
|
||||
* top to bottom.
|
||||
* Return an array of all the open and visible popup frames for
|
||||
* menus, in order from top to bottom.
|
||||
*/
|
||||
nsTArray<nsIFrame *> GetOpenPopups();
|
||||
nsTArray<nsIFrame *> GetVisiblePopups();
|
||||
|
||||
/**
|
||||
* Return false if a popup may not be opened. This will return false if the
|
||||
|
@ -135,6 +135,7 @@ NS_IMPL_ISUPPORTS5(nsXULPopupManager,
|
||||
|
||||
nsXULPopupManager::nsXULPopupManager() :
|
||||
mRangeOffset(0),
|
||||
mCachedMousePoint(nsIntPoint(0, 0)),
|
||||
mActiveMenuBar(nsnull),
|
||||
mPopups(nsnull),
|
||||
mNoHidePanels(nsnull),
|
||||
@ -1168,13 +1169,13 @@ nsXULPopupManager::GetTopPopup(nsPopupType aType)
|
||||
}
|
||||
|
||||
nsTArray<nsIFrame *>
|
||||
nsXULPopupManager::GetOpenPopups()
|
||||
nsXULPopupManager::GetVisiblePopups()
|
||||
{
|
||||
nsTArray<nsIFrame *> popups;
|
||||
|
||||
nsMenuChainItem* item = mPopups;
|
||||
while (item) {
|
||||
if (item->Frame()->PopupState() != ePopupInvisible)
|
||||
if (item->Frame()->PopupState() == ePopupOpenAndVisible)
|
||||
popups.AppendElement(static_cast<nsIFrame*>(item->Frame()));
|
||||
item = item->GetParent();
|
||||
}
|
||||
|
@ -738,7 +738,7 @@ pref("network.IDN.whitelist.xn--zckzah", true);
|
||||
// attempt and so we always display the domain name as punycode. This would
|
||||
// override the settings "network.IDN_show_punycode" and
|
||||
// "network.IDN.whitelist.*".
|
||||
pref("network.IDN.blacklist_chars", "\u0020\u00A0\u00BC\u00BD\u01C3\u0337\u0338\u05C3\u05F4\u06D4\u0702\u115F\u1160\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u200B\u2024\u2027\u2028\u2029\u202F\u2039\u203A\u2044\u205F\u2154\u2155\u2156\u2159\u215A\u215B\u215F\u2215\u23AE\u29F6\u29F8\u2AFB\u2AFD\u2FF0\u2FF1\u2FF2\u2FF3\u2FF4\u2FF5\u2FF6\u2FF7\u2FF8\u2FF9\u2FFA\u2FFB\u3000\u3002\u3014\u3015\u3033\u3164\u321D\u321E\u33AE\u33AF\u33C6\u33DF\uFE14\uFE15\uFE3F\uFE5D\uFE5E\uFEFF\uFF0E\uFF0F\uFF61\uFFA0\uFFF9\uFFFA\uFFFB\uFFFC\uFFFD");
|
||||
pref("network.IDN.blacklist_chars", "\u0020\u00A0\u00BC\u00BD\u00BE\u01C3\u02D0\u0337\u0338\u0589\u05C3\u05F4\u0609\u060A\u066A\u06D4\u0701\u0702\u0703\u0704\u115F\u1160\u1735\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u200B\u2024\u2027\u2028\u2029\u202F\u2039\u203A\u2041\u2044\u2052\u205F\u2153\u2154\u2155\u2156\u2157\u2158\u2159\u215A\u215B\u215C\u215D\u215E\u215F\u2215\u2236\u23AE\u2571\u29F6\u29F8\u2AFB\u2AFD\u2FF0\u2FF1\u2FF2\u2FF3\u2FF4\u2FF5\u2FF6\u2FF7\u2FF8\u2FF9\u2FFA\u2FFB\u3000\u3002\u3014\u3015\u3033\u3164\u321D\u321E\u33AE\u33AF\u33C6\u33DF\uA789\uFE14\uFE15\uFE3F\uFE5D\uFE5E\uFEFF\uFF0E\uFF0F\uFF61\uFFA0\uFFF9\uFFFA\uFFFB\uFFFC\uFFFD");
|
||||
|
||||
// This preference specifies a list of domains for which DNS lookups will be
|
||||
// IPv4 only. Works around broken DNS servers which can't handle IPv6 lookups
|
||||
@ -1551,6 +1551,10 @@ pref("intl.keyboard.per_window_layout", false);
|
||||
// Enable/Disable TSF support
|
||||
pref("intl.enable_tsf_support", false);
|
||||
|
||||
// We need to notify the layout change to TSF, but we cannot check the actual
|
||||
// change now, therefore, we always notify it by this fequency.
|
||||
pref("intl.tsf.on_layout_change_interval", 100);
|
||||
|
||||
// See bug 448927, on topmost panel, some IMEs are not usable on Windows.
|
||||
pref("ui.panel.default_level_parent", false);
|
||||
|
||||
|
@ -251,7 +251,7 @@ mozStorageConnection::Close()
|
||||
while (stmt = sqlite3_next_stmt(mDBConn, stmt)) {
|
||||
char *msg = PR_smprintf("SQL statement '%s' was not finalized",
|
||||
sqlite3_sql(stmt));
|
||||
NS_ERROR(msg);
|
||||
NS_WARNING(msg);
|
||||
PR_smprintf_free(msg);
|
||||
}
|
||||
#endif
|
||||
@ -264,7 +264,7 @@ mozStorageConnection::Close()
|
||||
|
||||
int srv = sqlite3_close(mDBConn);
|
||||
if (srv != SQLITE_OK)
|
||||
NS_ERROR("sqlite3_close failed. There are probably outstanding statements that are listed above!");
|
||||
NS_WARNING("sqlite3_close failed. There are probably outstanding statements that are listed above!");
|
||||
|
||||
mDBConn = NULL;
|
||||
return ConvertResultCode(srv);
|
||||
|
@ -96,6 +96,12 @@ CMMSRCS += progressui_osx.mm launchchild_osx.mm
|
||||
OS_LIBS += -framework Cocoa
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
CPPSRCS += \
|
||||
readstrings.cpp \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifndef HAVE_PROGRESSUI
|
||||
CPPSRCS += progressui_null.cpp
|
||||
endif
|
||||
@ -120,6 +126,11 @@ WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
|
||||
libs:: updater.png
|
||||
$(INSTALL) $(IFLAGS1) $^ $(DIST)/bin/icons
|
||||
endif
|
||||
|
||||
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
||||
libs::
|
||||
$(NSINSTALL) -D $(DIST)/bin/updater.app
|
||||
|
@ -21,6 +21,7 @@
|
||||
*
|
||||
* Contributor(s):
|
||||
* Darin Fisher <darin@meer.net>
|
||||
* David Dahl <ddahl@mozilla.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
@ -102,24 +103,21 @@ ShowProgressUI()
|
||||
if (sQuit || sProgressVal > 50.0f)
|
||||
return 0;
|
||||
|
||||
char path[PATH_MAX];
|
||||
snprintf(path, sizeof(path), "%s.ini", sProgramPath);
|
||||
char ini_path[PATH_MAX];
|
||||
snprintf(ini_path, sizeof(ini_path), "%s.ini", sProgramPath);
|
||||
|
||||
StringTable strings;
|
||||
if (ReadStrings(path, &strings) != OK)
|
||||
if (ReadStrings(ini_path, &strings) != OK)
|
||||
return -1;
|
||||
|
||||
|
||||
sWin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
if (!sWin)
|
||||
return -1;
|
||||
|
||||
// GTK 2.2 seems unable to prevent our dialog from being closed when
|
||||
// the user hits the close button on the dialog. This problem only
|
||||
// occurs when either one of the following methods are called:
|
||||
// gtk_window_set_position
|
||||
// gtk_window_set_type_hint
|
||||
// For this reason, we disable window decorations.
|
||||
|
||||
static GdkPixbuf *pixbuf;
|
||||
char icon_path[PATH_MAX];
|
||||
snprintf(icon_path, sizeof(icon_path), "%s.png", sProgramPath);
|
||||
|
||||
g_signal_connect(G_OBJECT(sWin), "delete_event",
|
||||
G_CALLBACK(OnDeleteEvent), NULL);
|
||||
|
||||
@ -127,7 +125,11 @@ ShowProgressUI()
|
||||
gtk_window_set_type_hint(GTK_WINDOW(sWin), GDK_WINDOW_TYPE_HINT_DIALOG);
|
||||
gtk_window_set_position(GTK_WINDOW(sWin), GTK_WIN_POS_CENTER_ALWAYS);
|
||||
gtk_window_set_resizable(GTK_WINDOW(sWin), FALSE);
|
||||
gtk_window_set_decorated(GTK_WINDOW(sWin), FALSE);
|
||||
gtk_window_set_decorated(GTK_WINDOW(sWin), TRUE);
|
||||
gtk_window_set_deletable(GTK_WINDOW(sWin),FALSE);
|
||||
pixbuf = gdk_pixbuf_new_from_file (icon_path, NULL);
|
||||
gtk_window_set_icon(GTK_WINDOW(sWin), pixbuf);
|
||||
g_object_unref(pixbuf);
|
||||
|
||||
GtkWidget *vbox = gtk_vbox_new(TRUE, 6);
|
||||
sLabel = gtk_label_new(strings.info);
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include "errors.h"
|
||||
#include "prtypes.h"
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
#ifdef XP_WIN
|
||||
# define NS_tfopen _wfopen
|
||||
# define OPEN_MODE L"rb"
|
||||
#else
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
#define MAX_TEXT_LEN 200
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
#ifdef XP_WIN
|
||||
# include <windows.h>
|
||||
typedef WCHAR NS_tchar;
|
||||
#else
|
||||
|
BIN
toolkit/mozapps/update/src/updater/updater.png
Normal file
BIN
toolkit/mozapps/update/src/updater/updater.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.9 KiB |
@ -39,7 +39,7 @@
|
||||
* This binary tests the updater's ReadStrings ini parser and should run in a
|
||||
* directory with a Unicode character to test bug 473417.
|
||||
*/
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
#ifdef XP_WIN
|
||||
#include <windows.h>
|
||||
#define NS_main wmain
|
||||
#define NS_tstrrchr wcsrchr
|
||||
@ -52,8 +52,12 @@
|
||||
#define NS_tstrrchr strrchr
|
||||
#define NS_tsnprintf snprintf
|
||||
#define NS_T(str) str
|
||||
#ifdef XP_OS2
|
||||
#define PATH_SEPARATOR_CHAR '\\'
|
||||
#else
|
||||
#define PATH_SEPARATOR_CHAR '/'
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -18,7 +18,8 @@ notification[type="critical"] {
|
||||
.messageImage {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin: 0px 1px 0px 6px;
|
||||
-moz-margin-start: 6px;
|
||||
-moz-margin-end: 1px;
|
||||
}
|
||||
|
||||
/* Default icons for notifications */
|
||||
@ -35,14 +36,6 @@ notification[type="critical"] .messageImage {
|
||||
list-style-image: url("chrome://global/skin/icons/error-16.png");
|
||||
}
|
||||
|
||||
.messageText {
|
||||
-moz-margin-start: 5px;
|
||||
}
|
||||
|
||||
.messageCloseButton {
|
||||
list-style-image: url("moz-icon://stock/gtk-close?size=menu");
|
||||
}
|
||||
|
||||
.messageCloseButton > .toolbarbutton-icon {
|
||||
margin: 0px !important;
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ notification[type="critical"] {
|
||||
.messageImage {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin: 0px 1px 0px 6px;
|
||||
-moz-margin-start: 6px;
|
||||
-moz-margin-end: 1px;
|
||||
}
|
||||
|
||||
/* Default icons for notifications */
|
||||
@ -35,10 +36,6 @@ notification[type="critical"] .messageImage {
|
||||
list-style-image: url("chrome://global/skin/icons/error-16.png");
|
||||
}
|
||||
|
||||
.messageText {
|
||||
-moz-margin-start: 5px;
|
||||
}
|
||||
|
||||
.messageCloseButton {
|
||||
list-style-image: url("chrome://global/skin/icons/close.png");
|
||||
-moz-appearance: none;
|
||||
@ -54,3 +51,7 @@ notification[type="critical"] .messageImage {
|
||||
.messageCloseButton:hover:active {
|
||||
-moz-image-region: rect(0px, 42px, 14px, 28px);
|
||||
}
|
||||
|
||||
.messageCloseButton > .toolbarbutton-icon {
|
||||
-moz-margin-end: 5px;
|
||||
}
|
||||
|
@ -494,7 +494,6 @@ MAKEFILES_widget="
|
||||
widget/src/os2/Makefile
|
||||
widget/src/windows/Makefile
|
||||
widget/src/xpwidgets/Makefile
|
||||
widget/src/support/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_xpcom="
|
||||
|
@ -111,6 +111,9 @@ static const char kUpdaterINI[] = "updater.ini";
|
||||
#ifdef XP_MACOSX
|
||||
static const char kUpdaterApp[] = "updater.app";
|
||||
#endif
|
||||
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
static const char kUpdaterPNG[] = "updater.png";
|
||||
#endif
|
||||
|
||||
static nsresult
|
||||
GetCurrentWorkingDir(char *buf, size_t size)
|
||||
@ -354,7 +357,13 @@ CopyUpdaterIntoUpdateDir(nsIFile *greDir, nsIFile *appDir, nsIFile *updateDir,
|
||||
return PR_FALSE;
|
||||
#endif
|
||||
CopyFileIntoUpdateDir(appDir, kUpdaterINI, updateDir);
|
||||
|
||||
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
nsCOMPtr<nsIFile> iconDir;
|
||||
appDir->Clone(getter_AddRefs(iconDir));
|
||||
iconDir->AppendNative(NS_LITERAL_CSTRING("icons"));
|
||||
if (!CopyFileIntoUpdateDir(iconDir, kUpdaterPNG, updateDir))
|
||||
return PR_FALSE;
|
||||
#endif
|
||||
// Finally, return the location of the updater binary.
|
||||
nsresult rv = updateDir->Clone(getter_AddRefs(updater));
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -525,7 +525,8 @@ void nsScrollPortView::Scroll(nsView *aScrolledView, nsPoint aTwipsDelta, nsIntP
|
||||
nsRegion updateRegion;
|
||||
PRBool canBitBlit = scrollWidget &&
|
||||
((mScrollProperties & NS_SCROLL_PROPERTY_ALWAYS_BLIT) ||
|
||||
mViewManager->CanScrollWithBitBlt(aScrolledView, aTwipsDelta, &updateRegion));
|
||||
mViewManager->CanScrollWithBitBlt(aScrolledView, aTwipsDelta, &updateRegion)) &&
|
||||
scrollWidget->GetTransparencyMode() != eTransparencyTransparent;
|
||||
|
||||
if (canBitBlit) {
|
||||
// We're going to bit-blit. Let the viewmanager know so it can
|
||||
|
@ -554,6 +554,10 @@ void nsViewManager::AddCoveringWidgetsToOpaqueRegion(nsRegion &aRgn, nsIDeviceCo
|
||||
return;
|
||||
}
|
||||
|
||||
if (widget->GetTransparencyMode() == eTransparencyTransparent) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (nsIWidget* childWidget = widget->GetFirstChild();
|
||||
childWidget;
|
||||
childWidget = childWidget->GetNextSibling()) {
|
||||
@ -813,22 +817,24 @@ nsViewManager::UpdateWidgetArea(nsView *aWidgetView, const nsRegion &aDamagedReg
|
||||
// accumulate the union of all the child widget areas, or at least
|
||||
// some subset of that.
|
||||
nsRegion children;
|
||||
for (nsIWidget* childWidget = widget->GetFirstChild();
|
||||
childWidget;
|
||||
childWidget = childWidget->GetNextSibling()) {
|
||||
nsView* view = nsView::GetViewFor(childWidget);
|
||||
NS_ASSERTION(view != aWidgetView, "will recur infinitely");
|
||||
if (view && view->GetVisibility() == nsViewVisibility_kShow) {
|
||||
// Don't mess with views that are in completely different view
|
||||
// manager trees
|
||||
if (view->GetViewManager()->RootViewManager() == RootViewManager()) {
|
||||
// get the damage region into 'view's coordinate system
|
||||
nsRegion damage = intersection;
|
||||
nsPoint offset = view->GetOffsetTo(aWidgetView);
|
||||
damage.MoveBy(-offset);
|
||||
UpdateWidgetArea(view, damage, aIgnoreWidgetView);
|
||||
children.Or(children, view->GetDimensions() + offset);
|
||||
children.SimplifyInward(20);
|
||||
if (widget->GetTransparencyMode() != eTransparencyTransparent) {
|
||||
for (nsIWidget* childWidget = widget->GetFirstChild();
|
||||
childWidget;
|
||||
childWidget = childWidget->GetNextSibling()) {
|
||||
nsView* view = nsView::GetViewFor(childWidget);
|
||||
NS_ASSERTION(view != aWidgetView, "will recur infinitely");
|
||||
if (view && view->GetVisibility() == nsViewVisibility_kShow) {
|
||||
// Don't mess with views that are in completely different view
|
||||
// manager trees
|
||||
if (view->GetViewManager()->RootViewManager() == RootViewManager()) {
|
||||
// get the damage region into 'view's coordinate system
|
||||
nsRegion damage = intersection;
|
||||
nsPoint offset = view->GetOffsetTo(aWidgetView);
|
||||
damage.MoveBy(-offset);
|
||||
UpdateWidgetArea(view, damage, aIgnoreWidgetView);
|
||||
children.Or(children, view->GetDimensions() + offset);
|
||||
children.SimplifyInward(20);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,8 +47,6 @@ XPIDL_MODULE = widget
|
||||
GRE_MODULE = 1
|
||||
|
||||
EXPORTS = \
|
||||
widgetCore.h \
|
||||
nsStringUtil.h \
|
||||
nsIWidget.h \
|
||||
nsGUIEvent.h \
|
||||
nsEvent.h \
|
||||
|
@ -1,60 +0,0 @@
|
||||
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// Convience macros for converting nsString's to chars +
|
||||
// creating temporary char[] bufs.
|
||||
|
||||
#ifndef NS_STR_UTIL_H
|
||||
#define NS_STR_UTIL_H
|
||||
|
||||
// temporary char[] macro
|
||||
|
||||
// Convience MACROS which use a static char array if possible to reduce
|
||||
// memory fragmentation, otherwise they allocate a char[] which must be
|
||||
// freed. REMEMBER to always use the NS_FREE_CHAR_BUF after using the
|
||||
// NS_ALLOC_CHAR_BUF. You can not nest NS_ALLOC_CHAR_BUF's.
|
||||
|
||||
#define NS_ALLOC_CHAR_BUF(aBuf, aSize, aActualSize) \
|
||||
int _ns_tmpActualSize = aActualSize; \
|
||||
char _ns_smallBuffer[aSize]; \
|
||||
char * const aBuf = _ns_tmpActualSize <= aSize ? _ns_smallBuffer : new char[_ns_tmpActualSize];
|
||||
|
||||
#define NS_FREE_CHAR_BUF(aBuf) \
|
||||
if (aBuf != _ns_smallBuffer) \
|
||||
delete[] aBuf;
|
||||
|
||||
#endif // !defined(NS_STR_UTIL_H)
|
@ -1,49 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Marco Pesenti Gritti <marco@gnome.org>
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef widgetCore_h__
|
||||
#define widgetCore_h__
|
||||
|
||||
#include "nscore.h"
|
||||
|
||||
#ifdef _IMPL_NS_WIDGET
|
||||
#define NS_WIDGET NS_EXPORT
|
||||
#else
|
||||
#define NS_WIDGET NS_IMPORT
|
||||
#endif
|
||||
|
||||
#endif
|
@ -44,9 +44,9 @@ include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = widget
|
||||
|
||||
DIRS = xpwidgets support
|
||||
DIRS = xpwidgets
|
||||
|
||||
ifneq (,$(filter beos os2 mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
||||
ifneq (,$(filter beos os2 cocoa qt,$(MOZ_WIDGET_TOOLKIT)))
|
||||
DIRS += $(MOZ_WIDGET_TOOLKIT)
|
||||
endif
|
||||
|
||||
@ -68,10 +68,6 @@ DIRS += gtkxtbin
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq (qt,$(MOZ_WIDGET_TOOLKIT))
|
||||
DIRS += qt
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_PHOTON
|
||||
DIRS += photon
|
||||
endif
|
||||
|
@ -1,116 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
#include "widgetCore.h"
|
||||
#include "nsWidgetSupport.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsIEventListener.h"
|
||||
#include "nsILookAndFeel.h"
|
||||
#include "nsIToolkit.h"
|
||||
#include "nsIWidget.h"
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID);
|
||||
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_ShowWidget(nsISupports* aWidget, PRBool aShow)
|
||||
{
|
||||
|
||||
nsIWidget* widget = nsnull;
|
||||
if (NS_OK == aWidget->QueryInterface(kIWidgetIID,(void**)&widget)) {
|
||||
widget->Show(aShow);
|
||||
NS_IF_RELEASE(widget);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_MoveWidget(nsISupports* aWidget, PRUint32 aX, PRUint32 aY)
|
||||
{
|
||||
|
||||
nsIWidget* widget = nsnull;
|
||||
if (NS_OK == aWidget->QueryInterface(kIWidgetIID,(void**)&widget)) {
|
||||
widget->Move(aX,aY);
|
||||
NS_IF_RELEASE(widget);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_EnableWidget(nsISupports* aWidget, PRBool aEnable)
|
||||
{
|
||||
nsIWidget* widget;
|
||||
if (NS_OK == aWidget->QueryInterface(kIWidgetIID,(void**)&widget))
|
||||
{
|
||||
widget->Enable(aEnable);
|
||||
NS_RELEASE(widget);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_SetFocusToWidget(nsISupports* aWidget)
|
||||
{
|
||||
|
||||
nsIWidget* widget = nsnull;
|
||||
if (NS_OK == aWidget->QueryInterface(kIWidgetIID,(void**)&widget)) {
|
||||
widget->SetFocus();
|
||||
NS_IF_RELEASE(widget);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
extern NS_WIDGET nsresult
|
||||
NS_GetWidgetNativeData(nsISupports* aWidget, void** aNativeData)
|
||||
{
|
||||
void* result = nsnull;
|
||||
nsIWidget* widget;
|
||||
if (NS_OK == aWidget->QueryInterface(kIWidgetIID,(void**)&widget))
|
||||
{
|
||||
result = widget->GetNativeData(NS_NATIVE_WIDGET);
|
||||
NS_RELEASE(widget);
|
||||
}
|
||||
*aNativeData = result;
|
||||
return NS_OK;
|
||||
|
||||
}
|
@ -56,7 +56,7 @@ CSRCS = \
|
||||
EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS) $(XLDFLAGS) $(XT_LIBS) $(XLIBS)
|
||||
endif
|
||||
|
||||
EXPORTS = gtkxtbin.h gtk2xtbin.h
|
||||
EXPORTS = gtk2xtbin.h
|
||||
|
||||
REQUIRES = xpcom
|
||||
|
||||
|
@ -1,596 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim:expandtab:shiftwidth=2:tabstop=2: */
|
||||
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the GtkXtBin Widget Implementation.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Intel Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* The GtkXtBin widget allows for Xt toolkit code to be used
|
||||
* inside a GTK application.
|
||||
*/
|
||||
|
||||
#include "gtkxtbin.h"
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include <glib.h>
|
||||
#include <assert.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* Xlib/Xt stuff */
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Shell.h>
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <X11/StringDefs.h>
|
||||
|
||||
/* uncomment this if you want debugging information about widget
|
||||
creation and destruction */
|
||||
/* #define DEBUG_XTBIN */
|
||||
|
||||
#define XTBIN_MAX_EVENTS 30
|
||||
|
||||
static void gtk_xtbin_class_init (GtkXtBinClass *klass);
|
||||
static void gtk_xtbin_init (GtkXtBin *xtbin);
|
||||
static void gtk_xtbin_realize (GtkWidget *widget);
|
||||
static void gtk_xtbin_destroy (GtkObject *object);
|
||||
static void gtk_xtbin_shutdown (GtkObject *object);
|
||||
static void gtk_xtbin_show (GtkWidget *widget);
|
||||
|
||||
static GtkWidgetClass *parent_class = NULL;
|
||||
|
||||
static String *fallback = NULL;
|
||||
static gboolean xt_is_initialized = FALSE;
|
||||
static gint num_widgets = 0;
|
||||
|
||||
static GPollFD xt_event_poll_fd;
|
||||
|
||||
static gboolean
|
||||
xt_event_prepare (gpointer source_data,
|
||||
GTimeVal *current_time,
|
||||
gint *timeout,
|
||||
gpointer user_data)
|
||||
{
|
||||
int mask;
|
||||
|
||||
GDK_THREADS_ENTER();
|
||||
mask = XPending((Display *)user_data);
|
||||
GDK_THREADS_LEAVE();
|
||||
|
||||
return (gboolean)mask;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
xt_event_check (gpointer source_data,
|
||||
GTimeVal *current_time,
|
||||
gpointer user_data)
|
||||
{
|
||||
GDK_THREADS_ENTER ();
|
||||
|
||||
if (xt_event_poll_fd.revents & G_IO_IN) {
|
||||
int mask;
|
||||
|
||||
mask = XPending((Display *)user_data);
|
||||
|
||||
GDK_THREADS_LEAVE ();
|
||||
|
||||
return (gboolean)mask;
|
||||
}
|
||||
|
||||
GDK_THREADS_LEAVE ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
xt_event_dispatch (gpointer source_data,
|
||||
GTimeVal *current_time,
|
||||
gpointer user_data)
|
||||
{
|
||||
XEvent event;
|
||||
Display * display;
|
||||
XtAppContext ac;
|
||||
int i = 0;
|
||||
|
||||
display = (Display *)user_data;
|
||||
ac = XtDisplayToApplicationContext(display);
|
||||
|
||||
GDK_THREADS_ENTER ();
|
||||
|
||||
/* Process only real X traffic here. We only look for data on the
|
||||
* pipe, limit it to XTBIN_MAX_EVENTS and only call
|
||||
* XtAppProcessEvent so that it will look for X events. There's no
|
||||
* timer processing here since we already have a timer callback that
|
||||
* does it. */
|
||||
for (i=0; i < XTBIN_MAX_EVENTS && XPending(display); i++) {
|
||||
XtAppProcessEvent(ac, XtIMXEvent);
|
||||
}
|
||||
|
||||
GDK_THREADS_LEAVE ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GSourceFuncs xt_event_funcs = {
|
||||
xt_event_prepare,
|
||||
xt_event_check,
|
||||
xt_event_dispatch,
|
||||
(GDestroyNotify)g_free
|
||||
};
|
||||
|
||||
static gint xt_polling_timer_id = 0;
|
||||
|
||||
static gboolean
|
||||
xt_event_polling_timer_callback(gpointer user_data)
|
||||
{
|
||||
Display * display;
|
||||
XtAppContext ac;
|
||||
int eventsToProcess = 20;
|
||||
|
||||
display = (Display *)user_data;
|
||||
ac = XtDisplayToApplicationContext(display);
|
||||
|
||||
/* We need to process many Xt events here. If we just process
|
||||
one event we might starve one or more Xt consumers. On the other hand
|
||||
this could hang the whole app if Xt events come pouring in. So process
|
||||
up to 20 Xt events right now and save the rest for later. This is a hack,
|
||||
but it oughta work. We *really* should have out of process plugins.
|
||||
*/
|
||||
while (eventsToProcess-- && XtAppPending(ac))
|
||||
XtAppProcessEvent(ac, XtIMAll);
|
||||
|
||||
/* restart the timer */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GtkType
|
||||
gtk_xtbin_get_type (void)
|
||||
{
|
||||
static GtkType xtbin_type = 0;
|
||||
|
||||
if (!xtbin_type)
|
||||
{
|
||||
static const GtkTypeInfo xtbin_info =
|
||||
{
|
||||
"GtkXtBin",
|
||||
sizeof (GtkXtBin),
|
||||
sizeof (GtkXtBinClass),
|
||||
(GtkClassInitFunc) gtk_xtbin_class_init,
|
||||
(GtkObjectInitFunc) gtk_xtbin_init,
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserved_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
xtbin_type = gtk_type_unique (GTK_TYPE_WIDGET, &xtbin_info);
|
||||
}
|
||||
|
||||
return xtbin_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_xtbin_class_init (GtkXtBinClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class;
|
||||
GtkObjectClass *object_class;
|
||||
|
||||
parent_class = gtk_type_class (gtk_widget_get_type ());
|
||||
|
||||
widget_class = GTK_WIDGET_CLASS (klass);
|
||||
widget_class->realize = gtk_xtbin_realize;
|
||||
widget_class->show = gtk_xtbin_show;
|
||||
|
||||
object_class = GTK_OBJECT_CLASS (klass);
|
||||
object_class->shutdown= gtk_xtbin_shutdown;
|
||||
object_class->destroy = gtk_xtbin_destroy;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_xtbin_init (GtkXtBin *xtbin)
|
||||
{
|
||||
xtbin->xtdisplay = NULL;
|
||||
xtbin->xtwidget = NULL;
|
||||
xtbin->parent_window = NULL;
|
||||
xtbin->xtwindow = 0;
|
||||
xtbin->x = 0;
|
||||
xtbin->y = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_xtbin_realize (GtkWidget *widget)
|
||||
{
|
||||
GdkWindowAttr attributes;
|
||||
gint attributes_mask, n;
|
||||
GtkXtBin *xtbin;
|
||||
Arg args[5];
|
||||
gint width, height;
|
||||
Widget top_widget;
|
||||
Window win;
|
||||
Widget embedded;
|
||||
|
||||
#ifdef DEBUG_XTBIN
|
||||
printf("gtk_xtbin_realize()\n");
|
||||
#endif
|
||||
|
||||
g_return_if_fail (GTK_IS_XTBIN (widget));
|
||||
|
||||
gdk_flush();
|
||||
xtbin = GTK_XTBIN (widget);
|
||||
|
||||
if (widget->allocation.x == -1 &&
|
||||
widget->allocation.y == -1 &&
|
||||
widget->allocation.width == 1 &&
|
||||
widget->allocation.height == 1)
|
||||
{
|
||||
GtkRequisition requisition;
|
||||
GtkAllocation allocation = { 0, 0, 200, 200 };
|
||||
|
||||
gtk_widget_size_request (widget, &requisition);
|
||||
if (requisition.width || requisition.height)
|
||||
{
|
||||
/* non-empty window */
|
||||
allocation.width = requisition.width;
|
||||
allocation.height = requisition.height;
|
||||
}
|
||||
gtk_widget_size_allocate (widget, &allocation);
|
||||
}
|
||||
|
||||
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
|
||||
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
attributes.x = xtbin->x;
|
||||
attributes.y = xtbin->y;
|
||||
attributes.width = widget->allocation.width;
|
||||
attributes.height = widget->allocation.height;
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
attributes.visual = gdk_window_get_visual (xtbin->parent_window);
|
||||
attributes.colormap = gdk_window_get_colormap (xtbin->parent_window);
|
||||
attributes.event_mask = gdk_window_get_events (xtbin->parent_window);
|
||||
attributes.event_mask |= GDK_EXPOSURE_MASK;
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y |
|
||||
GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
||||
|
||||
xtbin->width = attributes.width;
|
||||
xtbin->height = attributes.height;
|
||||
|
||||
widget->window = gdk_window_new (xtbin->parent_window,
|
||||
&attributes, attributes_mask);
|
||||
|
||||
/* Turn off any event catching for this window by */
|
||||
/* the Gtk/Gdk event loop... otherwise some strange */
|
||||
/* things happen */
|
||||
XSelectInput(GDK_WINDOW_XDISPLAY(widget->window),
|
||||
GDK_WINDOW_XWINDOW(widget->window),
|
||||
0);
|
||||
|
||||
gdk_window_set_user_data (widget->window, xtbin);
|
||||
|
||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
||||
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
|
||||
|
||||
/* ensure all the outgoing events are flushed */
|
||||
/* before we try this crazy dual toolkit stuff */
|
||||
gdk_flush();
|
||||
|
||||
|
||||
/***
|
||||
* I'm sure there is a better way, but for now I'm
|
||||
* just creating a new application shell (since it doesn't
|
||||
* need a parent widget,) and then swapping out the XWindow
|
||||
* from under it. This seems to mostly work, but it's
|
||||
* an ugly hack.
|
||||
*/
|
||||
|
||||
top_widget = XtAppCreateShell("drawingArea", "Wrapper",
|
||||
applicationShellWidgetClass, xtbin->xtdisplay,
|
||||
NULL, 0);
|
||||
|
||||
xtbin->xtwidget = top_widget;
|
||||
|
||||
/* set size of Xt window */
|
||||
n = 0;
|
||||
XtSetArg(args[n], XtNheight, xtbin->height);n++;
|
||||
XtSetArg(args[n], XtNwidth, xtbin->width);n++;
|
||||
XtSetValues(top_widget, args, n);
|
||||
|
||||
embedded = XtVaCreateWidget("form", compositeWidgetClass, top_widget, NULL);
|
||||
|
||||
n = 0;
|
||||
XtSetArg(args[n], XtNheight, xtbin->height);n++;
|
||||
XtSetArg(args[n], XtNwidth, xtbin->width);n++;
|
||||
XtSetArg(args[n], XtNvisual, GDK_VISUAL_XVISUAL(gdk_window_get_visual( xtbin->parent_window )) ); n++;
|
||||
XtSetArg(args[n], XtNdepth, gdk_window_get_visual( xtbin->parent_window )->depth ); n++;
|
||||
XtSetArg(args[n], XtNcolormap, GDK_COLORMAP_XCOLORMAP(gdk_window_get_colormap( xtbin->parent_window)) ); n++;
|
||||
XtSetValues(embedded, args, n);
|
||||
|
||||
/* Ok, here is the dirty little secret on how I am */
|
||||
/* switching the widget's XWindow to the GdkWindow's XWindow. */
|
||||
/* I should be ashamed of myself! */
|
||||
gtk_object_set_data(GTK_OBJECT(widget), "oldwindow",
|
||||
GUINT_TO_POINTER(top_widget->core.window)); /* save it off so we can get it during destroy */
|
||||
|
||||
top_widget->core.window = GDK_WINDOW_XWINDOW(widget->window);
|
||||
|
||||
|
||||
/* this little trick seems to finish initializing the widget */
|
||||
#if XlibSpecificationRelease >= 6
|
||||
XtRegisterDrawable(xtbin->xtdisplay,
|
||||
GDK_WINDOW_XWINDOW(widget->window),
|
||||
top_widget);
|
||||
#else
|
||||
_XtRegisterWindow( GDK_WINDOW_XWINDOW(widget->window),
|
||||
top_widget);
|
||||
#endif
|
||||
|
||||
XtRealizeWidget(embedded);
|
||||
#ifdef DEBUG_XTBIN
|
||||
printf("embedded window = %li\n", XtWindow(embedded));
|
||||
#endif
|
||||
XtManageChild(embedded);
|
||||
|
||||
/* now fill out the xtbin info */
|
||||
xtbin->xtwindow = XtWindow(embedded);
|
||||
|
||||
/* listen to all Xt events */
|
||||
XSelectInput(xtbin->xtdisplay,
|
||||
XtWindow(top_widget),
|
||||
0x0FFFFF);
|
||||
XSelectInput(xtbin->xtdisplay,
|
||||
XtWindow(embedded),
|
||||
0x0FFFFF);
|
||||
XFlush(xtbin->xtdisplay);
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
gtk_xtbin_new (GdkWindow *parent_window, String * f)
|
||||
{
|
||||
static Display *xtdisplay = NULL;
|
||||
|
||||
GtkXtBin *xtbin;
|
||||
assert(parent_window != NULL);
|
||||
|
||||
xtbin = gtk_type_new (GTK_TYPE_XTBIN);
|
||||
|
||||
if (!xtbin)
|
||||
return (GtkWidget*)NULL;
|
||||
|
||||
/* Initialize the Xt toolkit */
|
||||
if (!xt_is_initialized) {
|
||||
char *mArgv[1];
|
||||
int mArgc = 0;
|
||||
XtAppContext app_context;
|
||||
|
||||
#ifdef DEBUG_XTBIN
|
||||
printf("starting up Xt stuff\n");
|
||||
#endif
|
||||
/*
|
||||
* Initialize Xt stuff
|
||||
*/
|
||||
|
||||
XtToolkitInitialize();
|
||||
app_context = XtCreateApplicationContext();
|
||||
if (fallback)
|
||||
XtAppSetFallbackResources(app_context, fallback);
|
||||
|
||||
xtdisplay = XtOpenDisplay(app_context, gdk_get_display(), NULL,
|
||||
"Wrapper", NULL, 0, &mArgc, mArgv);
|
||||
|
||||
if (!xtdisplay) {
|
||||
/* If XtOpenDisplay failed, we can't go any further.
|
||||
* Bail out.
|
||||
*/
|
||||
#ifdef DEBUG_XTBIN
|
||||
printf("gtk_xtbin_init: XtOpenDisplay() returned NULL.\n");
|
||||
#endif
|
||||
|
||||
gtk_type_free (GTK_TYPE_XTBIN, xtbin);
|
||||
return (GtkWidget *)NULL;
|
||||
}
|
||||
|
||||
xt_is_initialized = TRUE;
|
||||
}
|
||||
|
||||
/* If this is the first running widget, hook this display into the
|
||||
mainloop */
|
||||
if (0 == num_widgets) {
|
||||
int cnumber;
|
||||
/*
|
||||
* hook Xt event loop into the glib event loop.
|
||||
*/
|
||||
|
||||
/* the assumption is that gtk_init has already been called */
|
||||
g_source_add (GDK_PRIORITY_EVENTS, TRUE,
|
||||
&xt_event_funcs, NULL, xtdisplay, (GDestroyNotify)NULL);
|
||||
|
||||
#ifdef VMS
|
||||
cnumber = XConnectionNumber(xtdisplay);
|
||||
#else
|
||||
cnumber = ConnectionNumber(xtdisplay);
|
||||
#endif
|
||||
xt_event_poll_fd.fd = cnumber;
|
||||
xt_event_poll_fd.events = G_IO_IN;
|
||||
xt_event_poll_fd.revents = 0; /* hmm... is this correct? */
|
||||
|
||||
g_main_add_poll (&xt_event_poll_fd, G_PRIORITY_LOW);
|
||||
|
||||
/* add a timer so that we can poll and process Xt timers */
|
||||
xt_polling_timer_id =
|
||||
gtk_timeout_add(25,
|
||||
(GtkFunction)xt_event_polling_timer_callback,
|
||||
xtdisplay);
|
||||
}
|
||||
|
||||
/* Bump up our usage count */
|
||||
num_widgets++;
|
||||
|
||||
xtbin->xtdisplay = xtdisplay;
|
||||
xtbin->parent_window = parent_window;
|
||||
if (f)
|
||||
fallback = f;
|
||||
|
||||
return GTK_WIDGET (xtbin);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_xtbin_set_position (GtkXtBin *xtbin,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
xtbin->x = x;
|
||||
xtbin->y = y;
|
||||
|
||||
if (GTK_WIDGET_REALIZED (xtbin))
|
||||
gdk_window_move (GTK_WIDGET (xtbin)->window, x, y);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_xtbin_resize (GtkWidget *widget,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
Arg args[2];
|
||||
GtkXtBin *xtbin = GTK_XTBIN (widget);
|
||||
Widget xtwidget = XtWindowToWidget(xtbin->xtdisplay, xtbin->xtwindow);
|
||||
|
||||
XtSetArg(args[0], XtNheight, height);
|
||||
XtSetArg(args[1], XtNwidth, width);
|
||||
XtSetValues(XtParent(xtwidget), args, 2);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_xtbin_shutdown (GtkObject *object)
|
||||
{
|
||||
GtkXtBin *xtbin;
|
||||
GtkWidget *widget;
|
||||
|
||||
#ifdef DEBUG_XTBIN
|
||||
printf("gtk_xtbin_shutdown()\n");
|
||||
#endif
|
||||
|
||||
/* gtk_object_destroy() will already hold a refcount on object
|
||||
*/
|
||||
xtbin = GTK_XTBIN(object);
|
||||
widget = GTK_WIDGET(object);
|
||||
|
||||
if (widget->parent)
|
||||
gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
|
||||
|
||||
GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE);
|
||||
if (GTK_WIDGET_REALIZED (widget)) {
|
||||
#if XlibSpecificationRelease >= 6
|
||||
XtUnregisterDrawable(xtbin->xtdisplay,
|
||||
GDK_WINDOW_XWINDOW(GTK_WIDGET(object)->window));
|
||||
#else
|
||||
_XtUnregisterWindow(GDK_WINDOW_XWINDOW(GTK_WIDGET(object)->window),
|
||||
XtWindowToWidget(xtbin->xtdisplay,
|
||||
GDK_WINDOW_XWINDOW(GTK_WIDGET(object)->window)));
|
||||
#endif
|
||||
|
||||
/* flush the queue before we returning origin top_widget->core.window
|
||||
or we can get X error since the window is gone */
|
||||
XSync(xtbin->xtdisplay, False);
|
||||
|
||||
xtbin->xtwidget->core.window = GPOINTER_TO_UINT(gtk_object_get_data(object, "oldwindow"));
|
||||
XtUnrealizeWidget(xtbin->xtwidget);
|
||||
|
||||
gtk_widget_unrealize (widget);
|
||||
}
|
||||
|
||||
|
||||
gtk_object_remove_data(object, "oldwindow");
|
||||
|
||||
GTK_OBJECT_CLASS(parent_class)->shutdown (object);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_xtbin_destroy (GtkObject *object)
|
||||
{
|
||||
GtkXtBin *xtbin;
|
||||
|
||||
#ifdef DEBUG_XTBIN
|
||||
printf("gtk_xtbin_destroy()\n");
|
||||
#endif
|
||||
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (GTK_IS_XTBIN (object));
|
||||
|
||||
xtbin = GTK_XTBIN (object);
|
||||
|
||||
XtDestroyWidget(xtbin->xtwidget);
|
||||
|
||||
num_widgets--; /* reduce our usage count */
|
||||
|
||||
/* If this is the last running widget, remove the Xt display
|
||||
connection from the mainloop */
|
||||
if (0 == num_widgets) {
|
||||
XtAppContext ac;
|
||||
|
||||
#ifdef DEBUG_XTBIN
|
||||
printf("removing the Xt connection from the main loop\n");
|
||||
#endif
|
||||
|
||||
g_main_remove_poll(&xt_event_poll_fd);
|
||||
g_source_remove_by_user_data(xtbin->xtdisplay);
|
||||
|
||||
gtk_timeout_remove(xt_polling_timer_id);
|
||||
xt_polling_timer_id = 0;
|
||||
|
||||
}
|
||||
|
||||
GTK_OBJECT_CLASS(parent_class)->destroy(object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_xtbin_show (GtkWidget *widget)
|
||||
{
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
#ifdef DEBUG_XTBIN
|
||||
printf("gtk_xtbin_show()\n");
|
||||
#endif
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (widget))
|
||||
{
|
||||
GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
|
||||
|
||||
if (!GTK_WIDGET_MAPPED(widget))
|
||||
gtk_widget_map (widget);
|
||||
}
|
||||
}
|
@ -1,149 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim:expandtab:shiftwidth=2:tabstop=2: */
|
||||
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Gtk2XtBin Widget Implementation.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Intel Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __GTK_XTBIN_H__
|
||||
#define __GTK_XTBIN_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xlib.h>
|
||||
#ifdef MOZILLA_CLIENT
|
||||
#include "nscore.h"
|
||||
#ifdef _IMPL_GTKXTBIN_API
|
||||
#define GTKXTBIN_API(type) NS_EXPORT_(type)
|
||||
#else
|
||||
#define GTKXTBIN_API(type) NS_IMPORT_(type)
|
||||
#endif
|
||||
#else
|
||||
#define GTKXTBIN_API(type) type
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct _GtkXtBin GtkXtBin;
|
||||
typedef struct _GtkXtBinClass GtkXtBinClass;
|
||||
|
||||
#define GTK_TYPE_XTBIN (gtk_xtbin_get_type ())
|
||||
#define GTK_XTBIN(obj) (GTK_CHECK_CAST ((obj), \
|
||||
GTK_TYPE_XTBIN, GtkXtBin))
|
||||
#define GTK_XTBIN_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), \
|
||||
GTK_TYPE_XTBIN, GtkXtBinClass))
|
||||
#define GTK_IS_XTBIN(obj) (GTK_CHECK_TYPE ((obj), \
|
||||
GTK_TYPE_XTBIN))
|
||||
#define GTK_IS_XTBIN_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), \
|
||||
GTK_TYPE_XTBIN))
|
||||
|
||||
struct _GtkXtBin
|
||||
{
|
||||
GtkWidget widget;
|
||||
GdkWindow *parent_window;
|
||||
Display *xtdisplay; /* Xt Toolkit Display */
|
||||
|
||||
Widget xtwidget; /* Xt Toolkit Widget */
|
||||
|
||||
Window xtwindow; /* Xt Toolkit XWindow */
|
||||
gint x, y;
|
||||
gint width, height;
|
||||
};
|
||||
|
||||
struct _GtkXtBinClass
|
||||
{
|
||||
GtkWidgetClass widget_class;
|
||||
};
|
||||
|
||||
GTKXTBIN_API(GtkType) gtk_xtbin_get_type (void);
|
||||
GTKXTBIN_API(GtkWidget *) gtk_xtbin_new (GdkWindow *parent_window, String *f);
|
||||
GTKXTBIN_API(void) gtk_xtbin_set_position (GtkXtBin *xtbin,
|
||||
gint x,
|
||||
gint y);
|
||||
GTKXTBIN_API(void) gtk_xtbin_resize (GtkWidget *widget,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
typedef struct _XtTMRec {
|
||||
XtTranslations translations; /* private to Translation Manager */
|
||||
XtBoundActions proc_table; /* procedure bindings for actions */
|
||||
struct _XtStateRec *current_state; /* Translation Manager state ptr */
|
||||
unsigned long lastEventTime;
|
||||
} XtTMRec, *XtTM;
|
||||
|
||||
typedef struct _CorePart {
|
||||
Widget self; /* pointer to widget itself */
|
||||
WidgetClass widget_class; /* pointer to Widget's ClassRec */
|
||||
Widget parent; /* parent widget */
|
||||
XrmName xrm_name; /* widget resource name quarkified */
|
||||
Boolean being_destroyed; /* marked for destroy */
|
||||
XtCallbackList destroy_callbacks; /* who to call when widget destroyed */
|
||||
XtPointer constraints; /* constraint record */
|
||||
Position x, y; /* window position */
|
||||
Dimension width, height; /* window dimensions */
|
||||
Dimension border_width; /* window border width */
|
||||
Boolean managed; /* is widget geometry managed? */
|
||||
Boolean sensitive; /* is widget sensitive to user events*/
|
||||
Boolean ancestor_sensitive; /* are all ancestors sensitive? */
|
||||
XtEventTable event_table; /* private to event dispatcher */
|
||||
XtTMRec tm; /* translation management */
|
||||
XtTranslations accelerators; /* accelerator translations */
|
||||
Pixel border_pixel; /* window border pixel */
|
||||
Pixmap border_pixmap; /* window border pixmap or NULL */
|
||||
WidgetList popup_list; /* list of popups */
|
||||
Cardinal num_popups; /* how many popups */
|
||||
String name; /* widget resource name */
|
||||
Screen *screen; /* window's screen */
|
||||
Colormap colormap; /* colormap */
|
||||
Window window; /* window ID */
|
||||
Cardinal depth; /* number of planes in window */
|
||||
Pixel background_pixel; /* window background pixel */
|
||||
Pixmap background_pixmap; /* window background pixmap or NULL */
|
||||
Boolean visible; /* is window mapped and not occluded?*/
|
||||
Boolean mapped_when_managed;/* map window if it's managed? */
|
||||
} CorePart;
|
||||
|
||||
typedef struct _WidgetRec {
|
||||
CorePart core;
|
||||
} WidgetRec, CoreRec;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __GTK_XTBIN_H__ */
|
||||
|
@ -15,6 +15,11 @@ bool MozQWidget::event(QEvent *e)
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
bool handled = true;
|
||||
|
||||
// always handle (delayed) delete requests triggered by
|
||||
// calling deleteLater() on this widget:
|
||||
if (e->type() == QEvent::DeferredDelete)
|
||||
return QObject::event(e);
|
||||
|
||||
if (!mReceiver)
|
||||
return false;
|
||||
|
||||
|
@ -1,62 +0,0 @@
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = widget
|
||||
LIBRARY_NAME = widgetsupport_s
|
||||
LIBXUL_LIBRARY = 1
|
||||
REQUIRES = xpcom \
|
||||
gfx \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = nsWidgetSupport.cpp
|
||||
|
||||
EXPORTS = nsWidgetSupport.h
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
CXXFLAGS += $(TK_CFLAGS)
|
||||
|
@ -1,98 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsWidgetSupport.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsIWidget.h"
|
||||
|
||||
nsresult
|
||||
NS_ShowWidget(nsISupports* aWidget, PRBool aShow)
|
||||
{
|
||||
nsCOMPtr<nsIWidget> widget = do_QueryInterface(aWidget);
|
||||
if (widget) {
|
||||
widget->Show(aShow);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_MoveWidget(nsISupports* aWidget, PRUint32 aX, PRUint32 aY)
|
||||
{
|
||||
nsCOMPtr<nsIWidget> widget = do_QueryInterface(aWidget);
|
||||
if (widget) {
|
||||
widget->Move(aX, aY);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_EnableWidget(nsISupports* aWidget, PRBool aEnable)
|
||||
{
|
||||
nsCOMPtr<nsIWidget> widget = do_QueryInterface(aWidget);
|
||||
if (widget) {
|
||||
widget->Enable(aEnable);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_SetFocusToWidget(nsISupports* aWidget)
|
||||
{
|
||||
nsCOMPtr<nsIWidget> widget = do_QueryInterface(aWidget);
|
||||
if (widget) {
|
||||
widget->SetFocus();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_GetWidgetNativeData(nsISupports* aWidget, void** aNativeData)
|
||||
{
|
||||
void *result = nsnull;
|
||||
nsCOMPtr<nsIWidget> widget = do_QueryInterface(aWidget);
|
||||
if (widget) {
|
||||
result = widget->GetNativeData(NS_NATIVE_WIDGET);
|
||||
}
|
||||
|
||||
*aNativeData = result;
|
||||
|
||||
return NS_OK;
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsWidgetSupport_h__
|
||||
#define nsWidgetSupport_h__
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIWidget.h"
|
||||
|
||||
|
||||
struct nsRect;
|
||||
class nsIAppShell;
|
||||
class nsIEventListener;
|
||||
class nsILookAndFeel;
|
||||
class nsIToolkit;
|
||||
class nsIWidget;
|
||||
class nsITooltipWidget;
|
||||
|
||||
extern nsresult
|
||||
NS_ShowWidget(nsISupports* aWidget, PRBool aShow);
|
||||
|
||||
extern nsresult
|
||||
NS_MoveWidget(nsISupports* aWidget, PRUint32 aX, PRUint32 aY);
|
||||
|
||||
extern nsresult
|
||||
NS_EnableWidget(nsISupports* aWidget, PRBool aEnable);
|
||||
|
||||
extern nsresult
|
||||
NS_SetFocusToWidget(nsISupports* aWidget);
|
||||
|
||||
extern nsresult
|
||||
NS_GetWidgetNativeData(nsISupports* aWidget, void** aNativeData);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -77,6 +77,10 @@ nsTextStore::nsTextStore()
|
||||
|
||||
nsTextStore::~nsTextStore()
|
||||
{
|
||||
if (mCompositionTimer) {
|
||||
mCompositionTimer->Cancel();
|
||||
mCompositionTimer = nsnull;
|
||||
}
|
||||
SaveTextEvent(nsnull);
|
||||
}
|
||||
|
||||
@ -1204,6 +1208,29 @@ nsTextStore::OnStartCompositionInternal(ITfCompositionView* pComposition,
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static PRUint32
|
||||
GetLayoutChangeIntervalTime()
|
||||
{
|
||||
static PRInt32 sTime = -1;
|
||||
if (sTime > 0)
|
||||
return PRUint32(sTime);
|
||||
|
||||
sTime = 100;
|
||||
nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||
if (!prefs)
|
||||
return PRUint32(sTime);
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch;
|
||||
prefs->GetBranch(nsnull, getter_AddRefs(prefBranch));
|
||||
if (!prefBranch)
|
||||
return PRUint32(sTime);
|
||||
nsresult rv =
|
||||
prefBranch->GetIntPref("intl.tsf.on_layout_change_interval", &sTime);
|
||||
if (NS_FAILED(rv))
|
||||
return PRUint32(sTime);
|
||||
sTime = PR_MAX(10, sTime);
|
||||
return PRUint32(sTime);
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
nsTextStore::OnStartComposition(ITfCompositionView* pComposition,
|
||||
BOOL* pfOk)
|
||||
@ -1218,9 +1245,18 @@ nsTextStore::OnStartComposition(ITfCompositionView* pComposition,
|
||||
HRESULT hr = pComposition->GetRange(getter_AddRefs(range));
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
|
||||
hr = OnStartCompositionInternal(pComposition, range, PR_FALSE);
|
||||
if (SUCCEEDED(hr))
|
||||
*pfOk = TRUE;
|
||||
return hr;
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
NS_ASSERTION(!mCompositionTimer, "The timer is alive!");
|
||||
mCompositionTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
|
||||
if (mCompositionTimer) {
|
||||
mCompositionTimer->InitWithFuncCallback(CompositionTimerCallbackFunc, this,
|
||||
GetLayoutChangeIntervalTime(),
|
||||
nsITimer::TYPE_REPEATING_SLACK);
|
||||
}
|
||||
*pfOk = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
@ -1272,6 +1308,11 @@ nsTextStore::OnEndComposition(ITfCompositionView* pComposition)
|
||||
// Clear the saved text event
|
||||
SaveTextEvent(nsnull);
|
||||
|
||||
if (mCompositionTimer) {
|
||||
mCompositionTimer->Cancel();
|
||||
mCompositionTimer = nsnull;
|
||||
}
|
||||
|
||||
// Use NS_TEXT_TEXT to commit composition string
|
||||
nsTextEvent textEvent(PR_TRUE, NS_TEXT_TEXT, mWindow);
|
||||
mWindow->InitEvent(textEvent);
|
||||
@ -1353,6 +1394,22 @@ nsTextStore::OnSelectionChangeInternal(void)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsTextStore::OnCompositionTimer()
|
||||
{
|
||||
NS_ENSURE_TRUE(mContext, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(mSink, NS_ERROR_FAILURE);
|
||||
|
||||
// XXXmnakano We always call OnLayoutChange for now, but this might use CPU
|
||||
// power when the focused editor has very long text. Ideally, we should call
|
||||
// this only when the composition string screen position is changed by window
|
||||
// moving, resizing. And also reflowing and scrolling the contents.
|
||||
HRESULT hr = mSink->OnLayoutChange(TS_LC_CHANGE, TEXTSTORE_DEFAULT_VIEW);
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsTextStore::CommitCompositionInternal(PRBool aDiscard)
|
||||
{
|
||||
|
@ -41,6 +41,8 @@
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsITimer.h"
|
||||
|
||||
#include <msctf.h>
|
||||
#include <textstor.h>
|
||||
@ -149,6 +151,12 @@ public:
|
||||
return sTsfTextStore->OnSelectionChangeInternal();
|
||||
}
|
||||
|
||||
static void CompositionTimerCallbackFunc(nsITimer *aTimer, void *aClosure)
|
||||
{
|
||||
nsTextStore *ts = static_cast<nsTextStore*>(aClosure);
|
||||
ts->OnCompositionTimer();
|
||||
}
|
||||
|
||||
// Returns the address of the pointer so that the TSF automatic test can
|
||||
// replace the system object with a custom implementation for testing.
|
||||
static void* GetThreadMgr(void)
|
||||
@ -193,6 +201,7 @@ protected:
|
||||
TF_DISPLAYATTRIBUTE* aResult);
|
||||
HRESULT SendTextEventForCompositionString();
|
||||
HRESULT SaveTextEvent(const nsTextEvent* aEvent);
|
||||
nsresult OnCompositionTimer();
|
||||
|
||||
// Document manager for the currently focused editor
|
||||
nsRefPtr<ITfDocumentMgr> mDocumentMgr;
|
||||
@ -232,6 +241,9 @@ protected:
|
||||
// The latest text event which was dispatched for composition string
|
||||
// of the current composing transaction.
|
||||
nsTextEvent* mLastDispatchedTextEvent;
|
||||
// Timer for calling ITextStoreACPSink::OnLayoutChange. This is only used
|
||||
// during composing.
|
||||
nsCOMPtr<nsITimer> mCompositionTimer;
|
||||
|
||||
// TSF thread manager object for the current application
|
||||
static ITfThreadMgr* sTsfThreadMgr;
|
||||
|
@ -8507,6 +8507,11 @@ void nsWindow::SetWindowTranslucencyInner(nsTransparencyMode aMode)
|
||||
style |= topWindow->WindowStyle();
|
||||
exStyle |= topWindow->WindowExStyle();
|
||||
|
||||
if (aMode == eTransparencyTransparent) {
|
||||
style &= ~(WS_CAPTION | WS_THICKFRAME | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
|
||||
exStyle &= ~(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE);
|
||||
}
|
||||
|
||||
VERIFY_WINDOW_STYLE(style);
|
||||
::SetWindowLongPtrW(hWnd, GWL_STYLE, style);
|
||||
::SetWindowLongPtrW(hWnd, GWL_EXSTYLE, exStyle);
|
||||
|
@ -101,6 +101,7 @@ OUTPARAMS_PASS_TESTCASES = \
|
||||
o16.cpp \
|
||||
onull.cpp \
|
||||
onull2.cpp \
|
||||
opmember.cpp \
|
||||
$(NULL)
|
||||
|
||||
FLOW_PASS_TESTCASES = \
|
||||
|
21
xpcom/tests/static-checker/opmember.cpp
Normal file
21
xpcom/tests/static-checker/opmember.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Make sure treehydra/outparams don't choke on pointer-to-members.
|
||||
*/
|
||||
|
||||
typedef int PRUint32;
|
||||
typedef PRUint32 nsresult;
|
||||
|
||||
class A
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
};
|
||||
|
||||
nsresult
|
||||
TestMethod(int A::* member,
|
||||
__attribute__((user("outparam"))) int *out) {
|
||||
*out = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -141,6 +141,11 @@ CertReader::OnStartRequest(nsIRequest *request, nsISupports* context)
|
||||
if (!mVerifier)
|
||||
return NS_BINDING_ABORTED;
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup;
|
||||
nsresult rv = request->GetLoadGroup(getter_AddRefs(loadGroup));
|
||||
if (NS_SUCCEEDED(rv) && loadGroup)
|
||||
loadGroup->RemoveRequest(request, nsnull, NS_BINDING_RETARGETED);
|
||||
|
||||
mLeftoverBuffer.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -121,36 +121,6 @@ FinalizeInstallTriggerGlobal(JSContext *cx, JSObject *obj)
|
||||
}
|
||||
}
|
||||
|
||||
static JSBool CreateNativeObject(JSContext *cx, JSObject *obj, nsIDOMInstallTriggerGlobal **aResult)
|
||||
{
|
||||
nsresult result;
|
||||
nsIScriptObjectOwner *owner = nsnull;
|
||||
nsIDOMInstallTriggerGlobal *nativeThis;
|
||||
|
||||
static NS_DEFINE_CID(kInstallTrigger_CID,
|
||||
NS_SoftwareUpdateInstallTrigger_CID);
|
||||
|
||||
result = CallCreateInstance(kInstallTrigger_CID, &nativeThis);
|
||||
if (NS_FAILED(result)) return JS_FALSE;
|
||||
|
||||
result = nativeThis->QueryInterface(NS_GET_IID(nsIScriptObjectOwner),
|
||||
(void **)&owner);
|
||||
|
||||
if (NS_OK != result)
|
||||
{
|
||||
NS_RELEASE(nativeThis);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
owner->SetScriptObject((void *)obj);
|
||||
JS_SetPrivate(cx, obj, nativeThis);
|
||||
|
||||
*aResult = nativeThis;
|
||||
|
||||
NS_RELEASE(nativeThis); // we only want one refcnt. JSUtils cleans us up.
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// Helper function for URI verification
|
||||
//
|
||||
@ -193,12 +163,7 @@ static nsIDOMInstallTriggerGlobal* getTriggerNative(JSContext *cx, JSObject *obj
|
||||
if (!JS_InstanceOf(cx, obj, &InstallTriggerGlobalClass, nsnull))
|
||||
return nsnull;
|
||||
|
||||
nsIDOMInstallTriggerGlobal *native = (nsIDOMInstallTriggerGlobal*)JS_GetPrivate(cx, obj);
|
||||
if (!native) {
|
||||
// xpinstall script contexts delay creation of the native.
|
||||
CreateNativeObject(cx, obj, &native);
|
||||
}
|
||||
return native;
|
||||
return (nsIDOMInstallTriggerGlobal*)JS_GetPrivate(cx, obj);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -118,16 +118,6 @@ nsXPITriggerItem::~nsXPITriggerItem()
|
||||
MOZ_COUNT_DTOR(nsXPITriggerItem);
|
||||
}
|
||||
|
||||
PRBool nsXPITriggerItem::IsRelativeURL()
|
||||
{
|
||||
PRInt32 cpos = mURL.FindChar(':');
|
||||
if (cpos == kNotFound)
|
||||
return PR_TRUE;
|
||||
|
||||
PRInt32 spos = mURL.FindChar('/');
|
||||
return (cpos > spos);
|
||||
}
|
||||
|
||||
const PRUnichar*
|
||||
nsXPITriggerItem::GetSafeURLString()
|
||||
{
|
||||
@ -206,20 +196,15 @@ nsXPITriggerInfo::~nsXPITriggerInfo()
|
||||
void nsXPITriggerInfo::SaveCallback( JSContext *aCx, jsval aVal )
|
||||
{
|
||||
NS_ASSERTION( mCx == 0, "callback set twice, memory leak" );
|
||||
// We'll only retain the callback if we can get a strong reference to the
|
||||
// context.
|
||||
if (!(JS_GetOptions(aCx) & JSOPTION_PRIVATE_IS_NSISUPPORTS))
|
||||
return;
|
||||
mContextWrapper = static_cast<nsISupports *>(JS_GetContextPrivate(aCx));
|
||||
if (!mContextWrapper)
|
||||
return;
|
||||
|
||||
mCx = aCx;
|
||||
JSObject *obj = JS_GetGlobalObject( mCx );
|
||||
|
||||
JSClass* clazz;
|
||||
|
||||
clazz = ::JS_GET_CLASS(aCx, obj);
|
||||
|
||||
if (clazz &&
|
||||
(clazz->flags & JSCLASS_HAS_PRIVATE) &&
|
||||
(clazz->flags & JSCLASS_PRIVATE_IS_NSISUPPORTS)) {
|
||||
mGlobalWrapper =
|
||||
do_QueryInterface((nsISupports*)::JS_GetPrivate(aCx, obj));
|
||||
}
|
||||
|
||||
mCbval = aVal;
|
||||
mThread = do_GetCurrentThread();
|
||||
|
||||
@ -242,12 +227,21 @@ XPITriggerEvent::Run()
|
||||
{
|
||||
jsval ret;
|
||||
void* mark;
|
||||
jsval* args;
|
||||
jsval* args = nsnull;
|
||||
|
||||
JS_BeginRequest(cx);
|
||||
args = JS_PushArguments(cx, &mark, "Wi",
|
||||
URL.get(),
|
||||
status);
|
||||
|
||||
// If Components doesn't exist in the global object then XPConnect has
|
||||
// been torn down, probably because the page was closed. Bail out if that
|
||||
// is the case.
|
||||
JSObject* innerGlobal = JS_GetGlobalForObject(cx, JSVAL_TO_OBJECT(cbval));
|
||||
jsval components;
|
||||
if (JS_LookupProperty(cx, innerGlobal, "Components", &components) &&
|
||||
JSVAL_IS_OBJECT(components))
|
||||
{
|
||||
args = JS_PushArguments(cx, &mark, "Wi", URL.get(), status);
|
||||
}
|
||||
|
||||
if ( args )
|
||||
{
|
||||
// This code is all in a JS request, and here we're about to
|
||||
@ -298,7 +292,7 @@ XPITriggerEvent::Run()
|
||||
else
|
||||
{
|
||||
JS_CallFunctionValue(cx,
|
||||
JSVAL_TO_OBJECT(global),
|
||||
JS_GetGlobalObject(cx),
|
||||
cbval,
|
||||
2,
|
||||
args,
|
||||
@ -320,7 +314,7 @@ void nsXPITriggerInfo::SendStatus(const PRUnichar* URL, PRInt32 status)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if ( mCx && mGlobalWrapper && !JSVAL_IS_NULL(mCbval) )
|
||||
if ( mCx && mContextWrapper && !JSVAL_IS_NULL(mCbval) )
|
||||
{
|
||||
// create event and post it
|
||||
nsRefPtr<XPITriggerEvent> event = new XPITriggerEvent();
|
||||
@ -331,12 +325,6 @@ void nsXPITriggerInfo::SendStatus(const PRUnichar* URL, PRInt32 status)
|
||||
event->cx = mCx;
|
||||
event->princ = mPrincipal;
|
||||
|
||||
JSObject *obj = nsnull;
|
||||
|
||||
mGlobalWrapper->GetJSObject(&obj);
|
||||
|
||||
event->global = OBJECT_TO_JSVAL(obj);
|
||||
|
||||
event->cbval = mCbval;
|
||||
JS_BeginRequest(event->cx);
|
||||
JS_AddNamedRoot(event->cx, &event->cbval,
|
||||
@ -345,7 +333,7 @@ void nsXPITriggerInfo::SendStatus(const PRUnichar* URL, PRInt32 status)
|
||||
|
||||
// Hold a strong reference to keep the underlying
|
||||
// JSContext from dying before we handle this event.
|
||||
event->ref = mGlobalWrapper;
|
||||
event->ref = mContextWrapper;
|
||||
|
||||
rv = mThread->Dispatch(event, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
@ -57,7 +57,6 @@ struct XPITriggerEvent : public nsRunnable {
|
||||
nsString URL;
|
||||
PRInt32 status;
|
||||
JSContext* cx;
|
||||
jsval global;
|
||||
jsval cbval;
|
||||
nsCOMPtr<nsISupports> ref;
|
||||
nsCOMPtr<nsIPrincipal> princ;
|
||||
@ -94,7 +93,6 @@ class nsXPITriggerItem
|
||||
void SetPrincipal(nsIPrincipal* aPrincipal);
|
||||
|
||||
PRBool IsFileURL() { return StringBeginsWith(mURL, NS_LITERAL_STRING("file:/")); }
|
||||
PRBool IsRelativeURL();
|
||||
|
||||
const PRUnichar* GetSafeURLString();
|
||||
|
||||
@ -132,7 +130,7 @@ class nsXPITriggerInfo
|
||||
private:
|
||||
nsVoidArray mItems;
|
||||
JSContext *mCx;
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> mGlobalWrapper;
|
||||
nsCOMPtr<nsISupports> mContextWrapper;
|
||||
jsval mCbval;
|
||||
nsCOMPtr<nsIThread> mThread;
|
||||
|
||||
|
@ -1139,6 +1139,9 @@ nsXPInstallManager::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
|
||||
}
|
||||
}
|
||||
|
||||
if (mLoadGroup)
|
||||
mLoadGroup->RemoveRequest(request, nsnull, NS_BINDING_RETARGETED);
|
||||
|
||||
NS_ASSERTION( mItem && mItem->mFile, "XPIMgr::OnStartRequest bad state");
|
||||
if ( mItem && mItem->mFile )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user