From 0eebfebe6c67b9a7413ec284cc6fed62d7897d70 Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Mon, 9 Jun 2014 12:40:48 +0100 Subject: [PATCH 01/68] Bug 467442 - take transforms into account for popup placement, r=bz,f=tnikkel --- layout/xul/nsMenuPopupFrame.cpp | 29 +++++++++++----- layout/xul/test/chrome.ini | 1 + layout/xul/test/test_bug467442.xul | 54 ++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 8 deletions(-) create mode 100644 layout/xul/test/test_bug467442.xul diff --git a/layout/xul/nsMenuPopupFrame.cpp b/layout/xul/nsMenuPopupFrame.cpp index c5397d1c2e0..790e8c30077 100644 --- a/layout/xul/nsMenuPopupFrame.cpp +++ b/layout/xul/nsMenuPopupFrame.cpp @@ -1156,15 +1156,28 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame, bool aIsMove, bool aS } } - // the dimensions of the anchor in its app units - nsRect parentRect = aAnchorFrame->GetScreenRectInAppUnits(); + // In order to deal with transforms, we need the root prescontext: + nsPresContext* rootPresContext = presContext->GetRootPresContext(); - // the anchor may be in a different document with a different scale, - // so adjust the size so that it is in the app units of the popup instead - // of the anchor. - parentRect = parentRect.ConvertAppUnitsRoundOut( - aAnchorFrame->PresContext()->AppUnitsPerDevPixel(), - presContext->AppUnitsPerDevPixel()); + // If we can't reach a root pres context, don't bother continuing: + if (!rootPresContext) { + return NS_OK; + } + + // And then we need its root frame for a reference + nsIFrame* referenceFrame = rootPresContext->FrameManager()->GetRootFrame(); + + // the dimensions of the anchor + nsRect parentRect = aAnchorFrame->GetRectRelativeToSelf(); + // Relative to the root + parentRect = nsLayoutUtils::TransformFrameRectToAncestor(aAnchorFrame, + parentRect, + referenceFrame); + // Relative to the screen + parentRect.MoveBy(referenceFrame->GetScreenRectInAppUnits().TopLeft()); + // In its own app units + parentRect.ConvertAppUnitsRoundOut(rootPresContext->AppUnitsPerDevPixel(), + presContext->AppUnitsPerDevPixel()); // Set the popup's size to the preferred size. Below, this size will be // adjusted to fit on the screen or within the content area. If the anchor diff --git a/layout/xul/test/chrome.ini b/layout/xul/test/chrome.ini index 4c438eef59f..1cdce3c6f43 100644 --- a/layout/xul/test/chrome.ini +++ b/layout/xul/test/chrome.ini @@ -9,6 +9,7 @@ support-files = [test_bug393970.xul] [test_bug398982-1.xul] [test_bug398982-2.xul] +[test_bug467442.xul] [test_bug477754.xul] [test_bug703150.xul] [test_popupSizeTo.xul] diff --git a/layout/xul/test/test_bug467442.xul b/layout/xul/test/test_bug467442.xul new file mode 100644 index 00000000000..809e90cb882 --- /dev/null +++ b/layout/xul/test/test_bug467442.xul @@ -0,0 +1,54 @@ + + + + + + + + + + Mozilla Bug 467442 + + From 49531a0e1503ad911a0054feb577d2e6345f88ff Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Thu, 12 Jun 2014 12:33:12 +0100 Subject: [PATCH 02/68] Bug 1022821, part 2 - In gfx code, stop returning RefPtr and, where not an out-param, stop using RefPtr arguments. r=Cwiiis --- gfx/thebes/gfxPattern.cpp | 2 +- gfx/thebes/gfxPattern.h | 2 +- gfx/thebes/gfxPlatform.cpp | 28 ++++++++++++++-------------- gfx/thebes/gfxPlatform.h | 19 +++++++++++-------- gfx/thebes/gfxUtils.cpp | 6 +++--- gfx/thebes/gfxUtils.h | 6 +++--- 6 files changed, 33 insertions(+), 30 deletions(-) diff --git a/gfx/thebes/gfxPattern.cpp b/gfx/thebes/gfxPattern.cpp index c1b3be319e1..5074a783c1b 100644 --- a/gfx/thebes/gfxPattern.cpp +++ b/gfx/thebes/gfxPattern.cpp @@ -98,7 +98,7 @@ gfxPattern::AddColorStop(gfxFloat offset, const gfxRGBA& c) } void -gfxPattern::SetColorStops(mozilla::RefPtr aStops) +gfxPattern::SetColorStops(GradientStops* aStops) { mStops = aStops; } diff --git a/gfx/thebes/gfxPattern.h b/gfx/thebes/gfxPattern.h index 23b2a803b22..1f69574695e 100644 --- a/gfx/thebes/gfxPattern.h +++ b/gfx/thebes/gfxPattern.h @@ -38,7 +38,7 @@ public: cairo_pattern_t *CairoPattern(); void AddColorStop(gfxFloat offset, const gfxRGBA& c); - void SetColorStops(mozilla::RefPtr aStops); + void SetColorStops(mozilla::gfx::GradientStops* aStops); // This should only be called on a cairo pattern that we want to use with // Azure. We will read back the color stops from cairo and try to look diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 8f8f25944b5..1da54853812 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -534,19 +534,19 @@ gfxPlatform::~gfxPlatform() cairo_user_data_key_t kDrawTarget; -RefPtr +TemporaryRef gfxPlatform::CreateDrawTargetForSurface(gfxASurface *aSurface, const IntSize& aSize) { SurfaceFormat format = Optimal2DFormatForContent(aSurface->GetContentType()); RefPtr drawTarget = Factory::CreateDrawTargetForCairoSurface(aSurface->CairoSurface(), aSize, &format); aSurface->SetData(&kDrawTarget, drawTarget, nullptr); - return drawTarget; + return drawTarget.forget(); } // This is a temporary function used by ContentClient to build a DrawTarget // around the gfxASurface. This should eventually be replaced by plumbing // the DrawTarget through directly -RefPtr +TemporaryRef gfxPlatform::CreateDrawTargetForUpdateSurface(gfxASurface *aSurface, const IntSize& aSize) { #ifdef XP_MACOSX @@ -643,7 +643,7 @@ CopySurface(gfxASurface* aSurface) return data; } -/* static */ RefPtr +/* static */ TemporaryRef gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurface) { if (!aSurface->CairoSurface() || aSurface->CairoStatus()) { @@ -709,7 +709,7 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa if (srcBuffer) { // It's cheap enough to make a new one so we won't keep it around and // keeping it creates a cycle. - return srcBuffer; + return srcBuffer.forget(); } } @@ -734,7 +734,7 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa // Our wrapping surface will hold a reference to its image surface. We cause // a reference cycle if we add it to the cache. And caching it is pretty // pointless since we'll just wrap it again next use. - return srcBuffer; + return srcBuffer.forget(); } } @@ -744,10 +744,10 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa srcSurfUD->mSrcSurface = srcBuffer; aSurface->SetData(&kSourceSurface, srcSurfUD, SourceBufferDestroy); - return srcBuffer; + return srcBuffer.forget(); } -RefPtr +TemporaryRef gfxPlatform::GetWrappedDataSourceSurface(gfxASurface* aSurface) { nsRefPtr image = aSurface->GetAsImageSurface(); @@ -770,7 +770,7 @@ gfxPlatform::GetWrappedDataSourceSurface(gfxASurface* aSurface) srcSurfUD->mSurface = aSurface; result->AddUserData(&kThebesSurface, srcSurfUD, SourceSurfaceDestroyed); - return result; + return result.forget(); } TemporaryRef @@ -927,7 +927,7 @@ gfxPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget) return surf.forget(); } -RefPtr +TemporaryRef gfxPlatform::CreateDrawTargetForBackend(BackendType aBackend, const IntSize& aSize, SurfaceFormat aFormat) { // There is a bunch of knowledge in the gfxPlatform heirarchy about how to @@ -951,27 +951,27 @@ gfxPlatform::CreateDrawTargetForBackend(BackendType aBackend, const IntSize& aSi } } -RefPtr +TemporaryRef gfxPlatform::CreateOffscreenCanvasDrawTarget(const IntSize& aSize, SurfaceFormat aFormat) { NS_ASSERTION(mPreferredCanvasBackend != BackendType::NONE, "No backend."); RefPtr target = CreateDrawTargetForBackend(mPreferredCanvasBackend, aSize, aFormat); if (target || mFallbackCanvasBackend == BackendType::NONE) { - return target; + return target.forget(); } return CreateDrawTargetForBackend(mFallbackCanvasBackend, aSize, aFormat); } -RefPtr +TemporaryRef gfxPlatform::CreateOffscreenContentDrawTarget(const IntSize& aSize, SurfaceFormat aFormat) { NS_ASSERTION(mPreferredCanvasBackend != BackendType::NONE, "No backend."); return CreateDrawTargetForBackend(mContentBackend, aSize, aFormat); } -RefPtr +TemporaryRef gfxPlatform::CreateDrawTargetForData(unsigned char* aData, const IntSize& aSize, int32_t aStride, SurfaceFormat aFormat) { NS_ASSERTION(mContentBackend != BackendType::NONE, "No backend."); diff --git a/gfx/thebes/gfxPlatform.h b/gfx/thebes/gfxPlatform.h index 24e38663fcf..62abdbcbbfe 100644 --- a/gfx/thebes/gfxPlatform.h +++ b/gfx/thebes/gfxPlatform.h @@ -155,7 +155,10 @@ GetBackendName(mozilla::gfx::BackendType aBackend) class gfxPlatform { public: + typedef mozilla::gfx::DataSourceSurface DataSourceSurface; + typedef mozilla::gfx::DrawTarget DrawTarget; typedef mozilla::gfx::IntSize IntSize; + typedef mozilla::gfx::SourceSurface SourceSurface; /** * Return a pointer to the current active platform. @@ -187,10 +190,10 @@ public: * support the DrawTarget we get back. * See SupportsAzureContentForDrawTarget. */ - virtual mozilla::RefPtr + virtual mozilla::TemporaryRef CreateDrawTargetForSurface(gfxASurface *aSurface, const mozilla::gfx::IntSize& aSize); - virtual mozilla::RefPtr + virtual mozilla::TemporaryRef CreateDrawTargetForUpdateSurface(gfxASurface *aSurface, const mozilla::gfx::IntSize& aSize); /* @@ -205,12 +208,12 @@ public: * PluginInstanceChild (where we can't call gfxPlatform::GetPlatform() * because the prefs service can only be accessed from the main process). */ - static mozilla::RefPtr + static mozilla::TemporaryRef GetSourceSurfaceForSurface(mozilla::gfx::DrawTarget *aTarget, gfxASurface *aSurface); static void ClearSourceSurfaceForSurface(gfxASurface *aSurface); - static mozilla::RefPtr + static mozilla::TemporaryRef GetWrappedDataSourceSurface(gfxASurface *aSurface); virtual mozilla::TemporaryRef @@ -219,13 +222,13 @@ public: virtual already_AddRefed GetThebesSurfaceForDrawTarget(mozilla::gfx::DrawTarget *aTarget); - mozilla::RefPtr + mozilla::TemporaryRef CreateOffscreenContentDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat); - mozilla::RefPtr + mozilla::TemporaryRef CreateOffscreenCanvasDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat); - virtual mozilla::RefPtr + virtual mozilla::TemporaryRef CreateDrawTargetForData(unsigned char* aData, const mozilla::gfx::IntSize& aSize, int32_t aStride, mozilla::gfx::SurfaceFormat aFormat); @@ -557,7 +560,7 @@ protected: * Helper method, creates a draw target for a specific Azure backend. * Used by CreateOffscreenDrawTarget. */ - mozilla::RefPtr + mozilla::TemporaryRef CreateDrawTargetForBackend(mozilla::gfx::BackendType aBackend, const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat); diff --git a/gfx/thebes/gfxUtils.cpp b/gfx/thebes/gfxUtils.cpp index fc781718fbe..9f99493e9f5 100644 --- a/gfx/thebes/gfxUtils.cpp +++ b/gfx/thebes/gfxUtils.cpp @@ -965,7 +965,7 @@ gfxUtils::CopyAsDataURL(DrawTarget* aDT) } /* static */ void -gfxUtils::WriteAsPNG(RefPtr aSourceSurface, const char* aFile) +gfxUtils::WriteAsPNG(gfx::SourceSurface* aSourceSurface, const char* aFile) { RefPtr dataSurface = aSourceSurface->GetDataSurface(); RefPtr dt @@ -978,7 +978,7 @@ gfxUtils::WriteAsPNG(RefPtr aSourceSurface, const char* aFil } /* static */ void -gfxUtils::DumpAsDataURL(RefPtr aSourceSurface) +gfxUtils::DumpAsDataURL(gfx::SourceSurface* aSourceSurface) { RefPtr dataSurface = aSourceSurface->GetDataSurface(); RefPtr dt @@ -991,7 +991,7 @@ gfxUtils::DumpAsDataURL(RefPtr aSourceSurface) } /* static */ void -gfxUtils::CopyAsDataURL(RefPtr aSourceSurface) +gfxUtils::CopyAsDataURL(gfx::SourceSurface* aSourceSurface) { RefPtr dataSurface = aSourceSurface->GetDataSurface(); RefPtr dt diff --git a/gfx/thebes/gfxUtils.h b/gfx/thebes/gfxUtils.h index d807b05345c..bcbfb1cf880 100644 --- a/gfx/thebes/gfxUtils.h +++ b/gfx/thebes/gfxUtils.h @@ -240,19 +240,19 @@ public: * Writes a binary PNG file. * Expensive. Creates a DataSourceSurface, then a DrawTarget, then passes to DrawTarget overloads */ - static void WriteAsPNG(mozilla::RefPtr aSourceSurface, const char* aFile); + static void WriteAsPNG(mozilla::gfx::SourceSurface* aSourceSurface, const char* aFile); /** * Write as a PNG encoded Data URL to stdout. * Expensive. Creates a DataSourceSurface, then a DrawTarget, then passes to DrawTarget overloads */ - static void DumpAsDataURL(mozilla::RefPtr aSourceSurface); + static void DumpAsDataURL(mozilla::gfx::SourceSurface* aSourceSurface); /** * Copy a PNG encoded Data URL to the clipboard. * Expensive. Creates a DataSourceSurface, then a DrawTarget, then passes to DrawTarget overloads */ - static void CopyAsDataURL(mozilla::RefPtr aSourceSurface); + static void CopyAsDataURL(mozilla::gfx::SourceSurface* aSourceSurface); #endif }; From 81b839f0ff284d99e2884aa8d133647f0f3fdbd8 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Thu, 12 Jun 2014 13:00:19 +0100 Subject: [PATCH 03/68] Backed out changeset cd50c7187a48 (bug 1022821) for compilation errors --- gfx/thebes/gfxPattern.cpp | 2 +- gfx/thebes/gfxPattern.h | 2 +- gfx/thebes/gfxPlatform.cpp | 28 ++++++++++++++-------------- gfx/thebes/gfxPlatform.h | 19 ++++++++----------- gfx/thebes/gfxUtils.cpp | 6 +++--- gfx/thebes/gfxUtils.h | 6 +++--- 6 files changed, 30 insertions(+), 33 deletions(-) diff --git a/gfx/thebes/gfxPattern.cpp b/gfx/thebes/gfxPattern.cpp index 5074a783c1b..c1b3be319e1 100644 --- a/gfx/thebes/gfxPattern.cpp +++ b/gfx/thebes/gfxPattern.cpp @@ -98,7 +98,7 @@ gfxPattern::AddColorStop(gfxFloat offset, const gfxRGBA& c) } void -gfxPattern::SetColorStops(GradientStops* aStops) +gfxPattern::SetColorStops(mozilla::RefPtr aStops) { mStops = aStops; } diff --git a/gfx/thebes/gfxPattern.h b/gfx/thebes/gfxPattern.h index 1f69574695e..23b2a803b22 100644 --- a/gfx/thebes/gfxPattern.h +++ b/gfx/thebes/gfxPattern.h @@ -38,7 +38,7 @@ public: cairo_pattern_t *CairoPattern(); void AddColorStop(gfxFloat offset, const gfxRGBA& c); - void SetColorStops(mozilla::gfx::GradientStops* aStops); + void SetColorStops(mozilla::RefPtr aStops); // This should only be called on a cairo pattern that we want to use with // Azure. We will read back the color stops from cairo and try to look diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 1da54853812..8f8f25944b5 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -534,19 +534,19 @@ gfxPlatform::~gfxPlatform() cairo_user_data_key_t kDrawTarget; -TemporaryRef +RefPtr gfxPlatform::CreateDrawTargetForSurface(gfxASurface *aSurface, const IntSize& aSize) { SurfaceFormat format = Optimal2DFormatForContent(aSurface->GetContentType()); RefPtr drawTarget = Factory::CreateDrawTargetForCairoSurface(aSurface->CairoSurface(), aSize, &format); aSurface->SetData(&kDrawTarget, drawTarget, nullptr); - return drawTarget.forget(); + return drawTarget; } // This is a temporary function used by ContentClient to build a DrawTarget // around the gfxASurface. This should eventually be replaced by plumbing // the DrawTarget through directly -TemporaryRef +RefPtr gfxPlatform::CreateDrawTargetForUpdateSurface(gfxASurface *aSurface, const IntSize& aSize) { #ifdef XP_MACOSX @@ -643,7 +643,7 @@ CopySurface(gfxASurface* aSurface) return data; } -/* static */ TemporaryRef +/* static */ RefPtr gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurface) { if (!aSurface->CairoSurface() || aSurface->CairoStatus()) { @@ -709,7 +709,7 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa if (srcBuffer) { // It's cheap enough to make a new one so we won't keep it around and // keeping it creates a cycle. - return srcBuffer.forget(); + return srcBuffer; } } @@ -734,7 +734,7 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa // Our wrapping surface will hold a reference to its image surface. We cause // a reference cycle if we add it to the cache. And caching it is pretty // pointless since we'll just wrap it again next use. - return srcBuffer.forget(); + return srcBuffer; } } @@ -744,10 +744,10 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa srcSurfUD->mSrcSurface = srcBuffer; aSurface->SetData(&kSourceSurface, srcSurfUD, SourceBufferDestroy); - return srcBuffer.forget(); + return srcBuffer; } -TemporaryRef +RefPtr gfxPlatform::GetWrappedDataSourceSurface(gfxASurface* aSurface) { nsRefPtr image = aSurface->GetAsImageSurface(); @@ -770,7 +770,7 @@ gfxPlatform::GetWrappedDataSourceSurface(gfxASurface* aSurface) srcSurfUD->mSurface = aSurface; result->AddUserData(&kThebesSurface, srcSurfUD, SourceSurfaceDestroyed); - return result.forget(); + return result; } TemporaryRef @@ -927,7 +927,7 @@ gfxPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget) return surf.forget(); } -TemporaryRef +RefPtr gfxPlatform::CreateDrawTargetForBackend(BackendType aBackend, const IntSize& aSize, SurfaceFormat aFormat) { // There is a bunch of knowledge in the gfxPlatform heirarchy about how to @@ -951,27 +951,27 @@ gfxPlatform::CreateDrawTargetForBackend(BackendType aBackend, const IntSize& aSi } } -TemporaryRef +RefPtr gfxPlatform::CreateOffscreenCanvasDrawTarget(const IntSize& aSize, SurfaceFormat aFormat) { NS_ASSERTION(mPreferredCanvasBackend != BackendType::NONE, "No backend."); RefPtr target = CreateDrawTargetForBackend(mPreferredCanvasBackend, aSize, aFormat); if (target || mFallbackCanvasBackend == BackendType::NONE) { - return target.forget(); + return target; } return CreateDrawTargetForBackend(mFallbackCanvasBackend, aSize, aFormat); } -TemporaryRef +RefPtr gfxPlatform::CreateOffscreenContentDrawTarget(const IntSize& aSize, SurfaceFormat aFormat) { NS_ASSERTION(mPreferredCanvasBackend != BackendType::NONE, "No backend."); return CreateDrawTargetForBackend(mContentBackend, aSize, aFormat); } -TemporaryRef +RefPtr gfxPlatform::CreateDrawTargetForData(unsigned char* aData, const IntSize& aSize, int32_t aStride, SurfaceFormat aFormat) { NS_ASSERTION(mContentBackend != BackendType::NONE, "No backend."); diff --git a/gfx/thebes/gfxPlatform.h b/gfx/thebes/gfxPlatform.h index 62abdbcbbfe..24e38663fcf 100644 --- a/gfx/thebes/gfxPlatform.h +++ b/gfx/thebes/gfxPlatform.h @@ -155,10 +155,7 @@ GetBackendName(mozilla::gfx::BackendType aBackend) class gfxPlatform { public: - typedef mozilla::gfx::DataSourceSurface DataSourceSurface; - typedef mozilla::gfx::DrawTarget DrawTarget; typedef mozilla::gfx::IntSize IntSize; - typedef mozilla::gfx::SourceSurface SourceSurface; /** * Return a pointer to the current active platform. @@ -190,10 +187,10 @@ public: * support the DrawTarget we get back. * See SupportsAzureContentForDrawTarget. */ - virtual mozilla::TemporaryRef + virtual mozilla::RefPtr CreateDrawTargetForSurface(gfxASurface *aSurface, const mozilla::gfx::IntSize& aSize); - virtual mozilla::TemporaryRef + virtual mozilla::RefPtr CreateDrawTargetForUpdateSurface(gfxASurface *aSurface, const mozilla::gfx::IntSize& aSize); /* @@ -208,12 +205,12 @@ public: * PluginInstanceChild (where we can't call gfxPlatform::GetPlatform() * because the prefs service can only be accessed from the main process). */ - static mozilla::TemporaryRef + static mozilla::RefPtr GetSourceSurfaceForSurface(mozilla::gfx::DrawTarget *aTarget, gfxASurface *aSurface); static void ClearSourceSurfaceForSurface(gfxASurface *aSurface); - static mozilla::TemporaryRef + static mozilla::RefPtr GetWrappedDataSourceSurface(gfxASurface *aSurface); virtual mozilla::TemporaryRef @@ -222,13 +219,13 @@ public: virtual already_AddRefed GetThebesSurfaceForDrawTarget(mozilla::gfx::DrawTarget *aTarget); - mozilla::TemporaryRef + mozilla::RefPtr CreateOffscreenContentDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat); - mozilla::TemporaryRef + mozilla::RefPtr CreateOffscreenCanvasDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat); - virtual mozilla::TemporaryRef + virtual mozilla::RefPtr CreateDrawTargetForData(unsigned char* aData, const mozilla::gfx::IntSize& aSize, int32_t aStride, mozilla::gfx::SurfaceFormat aFormat); @@ -560,7 +557,7 @@ protected: * Helper method, creates a draw target for a specific Azure backend. * Used by CreateOffscreenDrawTarget. */ - mozilla::TemporaryRef + mozilla::RefPtr CreateDrawTargetForBackend(mozilla::gfx::BackendType aBackend, const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat); diff --git a/gfx/thebes/gfxUtils.cpp b/gfx/thebes/gfxUtils.cpp index 9f99493e9f5..fc781718fbe 100644 --- a/gfx/thebes/gfxUtils.cpp +++ b/gfx/thebes/gfxUtils.cpp @@ -965,7 +965,7 @@ gfxUtils::CopyAsDataURL(DrawTarget* aDT) } /* static */ void -gfxUtils::WriteAsPNG(gfx::SourceSurface* aSourceSurface, const char* aFile) +gfxUtils::WriteAsPNG(RefPtr aSourceSurface, const char* aFile) { RefPtr dataSurface = aSourceSurface->GetDataSurface(); RefPtr dt @@ -978,7 +978,7 @@ gfxUtils::WriteAsPNG(gfx::SourceSurface* aSourceSurface, const char* aFile) } /* static */ void -gfxUtils::DumpAsDataURL(gfx::SourceSurface* aSourceSurface) +gfxUtils::DumpAsDataURL(RefPtr aSourceSurface) { RefPtr dataSurface = aSourceSurface->GetDataSurface(); RefPtr dt @@ -991,7 +991,7 @@ gfxUtils::DumpAsDataURL(gfx::SourceSurface* aSourceSurface) } /* static */ void -gfxUtils::CopyAsDataURL(gfx::SourceSurface* aSourceSurface) +gfxUtils::CopyAsDataURL(RefPtr aSourceSurface) { RefPtr dataSurface = aSourceSurface->GetDataSurface(); RefPtr dt diff --git a/gfx/thebes/gfxUtils.h b/gfx/thebes/gfxUtils.h index bcbfb1cf880..d807b05345c 100644 --- a/gfx/thebes/gfxUtils.h +++ b/gfx/thebes/gfxUtils.h @@ -240,19 +240,19 @@ public: * Writes a binary PNG file. * Expensive. Creates a DataSourceSurface, then a DrawTarget, then passes to DrawTarget overloads */ - static void WriteAsPNG(mozilla::gfx::SourceSurface* aSourceSurface, const char* aFile); + static void WriteAsPNG(mozilla::RefPtr aSourceSurface, const char* aFile); /** * Write as a PNG encoded Data URL to stdout. * Expensive. Creates a DataSourceSurface, then a DrawTarget, then passes to DrawTarget overloads */ - static void DumpAsDataURL(mozilla::gfx::SourceSurface* aSourceSurface); + static void DumpAsDataURL(mozilla::RefPtr aSourceSurface); /** * Copy a PNG encoded Data URL to the clipboard. * Expensive. Creates a DataSourceSurface, then a DrawTarget, then passes to DrawTarget overloads */ - static void CopyAsDataURL(mozilla::gfx::SourceSurface* aSourceSurface); + static void CopyAsDataURL(mozilla::RefPtr aSourceSurface); #endif }; From 5fb6194d5ddc2aa5ef53140288384aaba4501305 Mon Sep 17 00:00:00 2001 From: Giovanni Sferro Date: Mon, 9 Jun 2014 21:51:00 -0400 Subject: [PATCH 04/68] Bug 597650 - Label controls don't apply to input controls with type="hidden". r=smaug --- .../html/content/src/nsGenericHTMLElement.cpp | 3 +- content/html/content/test/forms/mochitest.ini | 1 + .../test/forms/test_label_input_controls.html | 84 +++++++++++++++++++ 3 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 content/html/content/test/forms/test_label_input_controls.html diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 4b72322cb86..3161f746290 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -2574,9 +2574,8 @@ bool nsGenericHTMLFormElement::IsLabelable() const { // TODO: keygen should be in that list, see bug 101019. - // TODO: NS_FORM_INPUT_HIDDEN should be removed, see bug 597650. uint32_t type = GetType(); - return type & NS_FORM_INPUT_ELEMENT || + return (type & NS_FORM_INPUT_ELEMENT && type != NS_FORM_INPUT_HIDDEN) || type & NS_FORM_BUTTON_ELEMENT || // type == NS_FORM_KEYGEN || type == NS_FORM_OUTPUT || diff --git a/content/html/content/test/forms/mochitest.ini b/content/html/content/test/forms/mochitest.ini index 01017a0c4ed..46235c8d62d 100644 --- a/content/html/content/test/forms/mochitest.ini +++ b/content/html/content/test/forms/mochitest.ini @@ -56,6 +56,7 @@ skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop spec [test_input_untrusted_key_events.html] [test_input_url.html] [test_label_control_attribute.html] +[test_label_input_controls.html] [test_max_attribute.html] skip-if = e10s [test_maxlength_attribute.html] diff --git a/content/html/content/test/forms/test_label_input_controls.html b/content/html/content/test/forms/test_label_input_controls.html new file mode 100644 index 00000000000..0ed847f0bfe --- /dev/null +++ b/content/html/content/test/forms/test_label_input_controls.html @@ -0,0 +1,84 @@ + + + + + Test for Bug 597650 + + + + + + Mozilla Bug 597650 +

+
+ + +
+
+    
+  
+ + + From 10f6a24e67165879006020ad40ab6870e850574c Mon Sep 17 00:00:00 2001 From: Ekanan Ketunuti Date: Tue, 10 Jun 2014 09:32:30 +0700 Subject: [PATCH 05/68] Bug 956541 - Add Mozillian to the en-US dictionary. r=ehsan --- .../dictionary-sources/upstream-hunspell.diff | 2871 +++++++++-------- .../locales/en-US/hunspell/en-US.dic | 3 +- 2 files changed, 1438 insertions(+), 1436 deletions(-) diff --git a/extensions/spellcheck/locales/en-US/hunspell/dictionary-sources/upstream-hunspell.diff b/extensions/spellcheck/locales/en-US/hunspell/dictionary-sources/upstream-hunspell.diff index ad99f4450f1..89730320658 100644 --- a/extensions/spellcheck/locales/en-US/hunspell/dictionary-sources/upstream-hunspell.diff +++ b/extensions/spellcheck/locales/en-US/hunspell/dictionary-sources/upstream-hunspell.diff @@ -6327,138 +6327,139 @@ 6596a10676,10677 > Moyna/M > Moyra/M -6600c10681,10682 +6600c10681,10683 < Mozilla/M --- > Mozelle/M > Mozes/M -6608a10691,10693 +> Mozillian/SM +6608a10692,10694 > Muffin/M > Mufi/M > Mufinella/M -6613a10699 +6613a10700 > Muire/M -6628a10715 +6628a10716 > Munmro/M -6630a10718 +6630a10719 > Munroe/M -6637a10726,10728 +6637a10727,10729 > Murdock/M > Mureil/M > Murial/M -6638a10730 +6638a10731 > Murielle/M -6645a10738,10739 +6645a10739,10740 > Murry/M > Murvyn/M -6657a10752 +6657a10753 > My/M -6659a10755,10756 +6659a10756,10757 > Myca/M > Mycah/M -6662c10759,10760 +6662c10760,10761 < Myers --- > Mychal/M > Myer/SM -6664a10763 +6664a10764 > Mylo/M -6665a10765,10766 +6665a10766,10767 > Myrah/M > Myranda/M -6666a10768,10771 +6666a10769,10772 > Myriam/M > Myrilla/M > Myrle/M > Myrlene/M -6668a10774,10777 +6668a10775,10778 > Myrta/M > Myrtia/M > Myrtice/M > Myrtie/M -6669a10779,10780 +6669a10780,10781 > Myrvyn/M > Myrwyn/M -6670a10782 +6670a10783 > MySpell/M -6720a10833,10835 +6720a10834,10836 > Nada/M > Nadean/M > Nadeen/M -6723a10839,10841 +6723a10840,10842 > Nadiya/M > Nady/M > Nadya/M -6733a10852 +6733a10853 > Nalani/M -6738a10858 +6738a10859 > Nana/M -6739a10860,10863 +6739a10861,10864 > Nananne/M > Nance/M > Nancee/M > Nancey/M -6740a10865,10866 +6740a10866,10867 > Nanci/M > Nancie/M -6741a10868 +6741a10869 > Nanete/M -6742a10870,10872 +6742a10871,10873 > Nani/M > Nanice/M > Nanine/M -6744a10875,10876 +6744a10876,10877 > Nannette/M > Nanni/M -6745a10878,10879 +6745a10879,10880 > Nanny/M > Nanon/M -6749a10884 +6749a10885 > Naoma/M -6750a10886 +6750a10887 > Nap/M -6755a10892,10893 +6755a10893,10894 > Nappie/M > Nappy/M -6756a10895 +6756a10896 > Nara -6757a10897,10898 +6757a10898,10899 > Nari/M > Nariko/M -6767a10909,10913 +6767a10910,10914 > Nata/M > Natal/M > Natala/M > Natale/M > Natalee/M -6769a10916,10919 +6769a10917,10920 > Natalina/M > Nataline/M > Natalya/M > Nataniel/M -6770a10921 +6770a10922 > Natassia/M -6772a10924,10925 +6772a10925,10926 > Nathalia/M > Nathalie/M -6773a10927,10928 +6773a10928,10929 > Nathanael > Nathanial/M -6774a10930 +6774a10931 > Nathanil/M -6775a10932 +6775a10933 > Natividad/M -6776a10934,10935 +6776a10935,10936 > Natka/M > Natty/M -6800a10960,10965 +6800a10961,10966 > Neala/M > Neale/M > Neall/M > Nealon/M > Nealson/M > Nealy/M -6808a10974,10981 +6808a10975,10982 > Neda/M > Nedda/M > Neddie/M @@ -6467,7 +6468,7 @@ > Neel/M > Neely/M > Nefen/M -6818c10991,10996 +6818c10992,10997 < Neil/M --- > Neil/SM @@ -6476,18 +6477,18 @@ > Neill/M > Neilla/M > Neille/M -6819a10998,10999 +6819a10999,11000 > Nelia/M > Nelie/M -6820a11001,11002 +6820a11002,11003 > Nelle/M > Nelli/M -6822a11005 +6822a11006 > Nels/N -6834a11018,11019 +6834a11019,11020 > Nerissa/M > Nerita/M -6835a11021,11027 +6835a11022,11028 > Neron/M > Nert/M > Nerta/M @@ -6495,45 +6496,45 @@ > Nerti/M > Nertie/M > Nerty/M -6837a11030 +6837a11031 > Nessa/M -6838a11032,11036 +6838a11033,11037 > Nessi/M > Nessie/M > Nessy/M > Nesta/M > Nester/M -6844c11042,11043 +6844c11043,11044 < Netscape/M --- > Netta/M > Netti/M -6845a11045,11046 +6845a11046,11047 > Nettle/M > Netty/M -6851a11053,11056 +6851a11054,11057 > Nevil/M > Nevile/M > Neville/M > Nevin/MS -6852a11058 +6852a11059 > Nevsa/M -6862a11069 +6862a11070 > Neysa/M -6866a11074,11075 +6866a11075,11076 > Nial/M > Niall/M -6875a11085 +6875a11086 > Nichol/SM -6878c11088 +6878c11089 < Nichols --- > Nicholle/M -6881a11092,11094 +6881a11093,11095 > Nickey/M > Nicki/M > Nickie/M -6883c11096,11101 +6883c11097,11102 < Nickolas --- > Nicko/M @@ -6542,221 +6543,221 @@ > Nickolaus/M > Nicky/M > Nico/M -6885a11104 +6885a11105 > Nicol/M -6886a11106 +6886a11107 > Nicolai/S -6887a11108,11113 +6887a11109,11114 > Nicolea/M > Nicolette/M > Nicoli/SM > Nicolina/M > Nicoline/M > Nicolle/M -6890c11116,11117 +6890c11117,11118 < Nielsen --- > Niel/SM > Niels/N -6899a11127 +6899a11128 > Nikaniki/M -6900a11129 +6900a11130 > Niki/M -6903a11133,11135 +6903a11134,11136 > Nikkie/M > Niko/SM > Nikola/SM -6904a11137,11138 +6904a11138,11139 > Nikolaos/M > Nikolaus/M -6905a11140,11142 +6905a11141,11143 > Nikoletta/M > Nikolia/M > Nikolos/M -6907c11144,11146 +6907c11145,11147 < Nile/M --- > Nil/SM > Nile/SM > Nilson/M -6910a11150,11151 +6910a11151,11152 > Ninetta/M > Ninette/M -6911a11153,11155 +6911a11154,11156 > Ninnetta/M > Ninnette/M > Ninon/M -6919a11164 +6919a11165 > Nissa/M -6920a11166,11168 +6920a11167,11169 > Nisse/M > Nissie/M > Nissy/M -6922a11171,11172 +6922a11172,11173 > Niven/M > Nixie -6926a11177 +6926a11178 > Noach/M -6927a11179,11182 +6927a11180,11183 > Noak/M > Noam/M > Noami/M > Nobe/M -6929a11185 +6929a11186 > Nobie/M -6930a11187 +6930a11188 > Noby/M -6932a11190,11192 +6932a11191,11193 > Noelani/M > Noell/M > Noella/M -6933a11194,11195 +6933a11195,11196 > Noellyn/M > Noelyn/M -6938a11201,11206 +6938a11202,11207 > Nolana/M > Noland/M > Nolie/M > Noll/M > Nollie/M > Nolly/M -6939a11208 +6939a11209 > Nomi/M -6940a11210,11214 +6940a11211,11215 > Nonah/M > Noni/M > Nonie/M > Nonna/M > Nonnah/M -6942a11217 +6942a11218 > Norah/M -6944a11220,11221 +6944a11221,11222 > Norbie/M > Norby/M -6945a11223 +6945a11224 > Norean/M -6946a11225 +6946a11226 > Norene/M -6948a11228,11229 +6948a11229,11230 > Norina/M > Norine/M -6952a11234,11235 +6952a11235,11236 > Normie/M > Normy/M -6954c11237,11239 +6954c11238,11240 < Norris --- > Norri/MS > Norrie/M > Norry/M -6973a11259 +6973a11260 > Notre -6979a11266 +6979a11267 > Novelia/M -6985a11273 +6985a11274 > Nowell/M -7001a11290,11291 +7001a11291,11292 > Nydia/M > Nye/M -7002a11293 +7002a11294 > Nyssa/M -7042c11333 +7042c11334 < Ob/M --- > Ob/MD -7043a11335,11337 +7043a11336,11338 > Obadias/M > Obed/M > Obediah/M -7046a11341,11343 +7046a11342,11344 > Obidiah/M > Obie > Oby/M -7057a11355 +7057a11356 > Octavius/M -7058a11357,11360 +7058a11358,11361 > Ode/RM > Odele/M > Odelia/M > Odelinda/M -7059a11362,11363 +7059a11363,11364 > Odella/M > Odelle/M -7062a11367,11372 +7062a11368,11373 > Odetta/M > Odette/M > Odey/M > Odie/M > Odilia/M > Odille/M -7064a11375 +7064a11376 > Odo/M -7065a11377 +7065a11378 > Ody/M -7071a11384 +7071a11385 > Ofella/M -7073a11387 +7073a11388 > Ofilia/M -7074a11389 +7074a11390 > Ogdan/M -7075a11391 +7075a11392 > Ogdon/M -7094a11411 +7094a11412 > Olag/M -7100a11418 +7100a11419 > Ole/MV -7102a11421,11422 +7102a11422,11423 > Olenka/M > Olenolin/M -7103a11424 +7103a11425 > Olia/M -7104a11426 +7104a11427 > Olimpia/M -7106a11429,11430 +7106a11430,11431 > Olivero/M > Olivette/M -7109c11433,11435 +7109c11434,11436 < Olivier --- > Olivie/MR > Oliviero/M > Oliy/M -7110a11437 +7110a11438 > Olly/M -7114a11442,11445 +7114a11443,11446 > Olva/M > Olvan/M > Olwen/M > Olympe/M -7118a11450 +7118a11451 > Olympie/M -7125a11458 +7125a11459 > Omero/M -7128a11462 +7128a11463 > Ondrea/M -7132a11467,11469 +7132a11468,11470 > Onfre/M > Onfroi/M > Onida/M -7134a11472 +7134a11473 > Onofredo/M -7139a11478 +7139a11479 > Oona/M -7141a11481,11482 +7141a11482,11483 > Opalina/M > Opaline/M -7143a11485 +7143a11486 > Ophelie/M -7148a11491,11495 +7148a11492,11496 > Oralee/M > Oralia/M > Oralie/M > Oralla/M > Oralle/M -7151a11499,11500 +7151a11500,11501 > Orazio/M > Orbadiah/M -7157a11507,11513 +7157a11508,11514 > Orel > Orelee/M > Orelia/M @@ -6764,12 +6765,12 @@ > Orella/M > Orelle/M > Oren/M -7159a11516 +7159a11517 > Oriana/M -7167a11525,11526 +7167a11526,11527 > Orlan/M > Orland/M -7174c11533,11539 +7174c11534,11540 < Orr/M --- > Orr/MN @@ -6779,348 +6780,348 @@ > Orsa/M > Orsola/M > Orson/M -7175a11541 +7175a11542 > Ortensia/M -7177a11544,11545 +7177a11545,11546 > Orton/M > Orv/M -7186a11555,11556 +7186a11556,11557 > Osbourn/M > Osbourne/M -7194a11565,11567 +7194a11566,11568 > Osmond/M > Osmund/M > Ossie/M -7198a11572,11576 +7198a11573,11577 > Oswell/M > Otes > Otha/M > Othelia/M > Othella/M -7199a11578,11580 +7199a11579,11581 > Othilia/M > Othilie/M > Otho/M -7201a11583 +7201a11584 > Ottilie/M -7217a11600 +7217a11601 > Ozzy/M -7264a11648,11650 +7264a11649,11651 > Packston/M > Paco/M > Pacorro/M -7265a11652,11653 +7265a11653,11654 > Paddie/M > Paddy/M -7266a11655,11656 +7266a11656,11657 > Padget/M > Padgett/M -7267a11658,11660 +7267a11659,11661 > Padraic/M > Padraig/M > Padriac/M -7272a11666 +7272a11667 > Pail/M -7288a11683 +7288a11684 > Palin/MS -7289a11685 +7289a11686 > Pall/M -7291c11687 +7291c11688 < Palmer --- > Palm/MR -7294a11691 +7294a11692 > Paloma/M -7297a11695,11696 +7297a11696,11697 > Pamelina/M > Pamella/M -7298a11698,11700 +7298a11699,11701 > Pammi/M > Pammie/M > Pammy/M -7303a11706,11707 +7303a11707,11708 > Panchito/M > Pancho/M -7307a11712 +7307a11713 > Pansie/M -7312a11718,11723 +7312a11719,11724 > Paola/M > Paolina/M > Paolo/M > Papagena/M > Papageno/M > Paquito/M -7325a11737 +7325a11738 > Parke/M -7335a11748,11749 +7335a11749,11750 > Parrnell/M > Parry -7341a11756 +7341a11757 > Pascale/M -7347c11762 +7347c11763 < Pat --- > Pat/N -7351a11767 +7351a11768 > Paten/M -7352a11769,11770 +7352a11770,11771 > Patience/M > Patin/M -7353a11772,11773 +7353a11773,11774 > Paton > Patric/M -7356a11777 +7356a11778 > Patricio/M -7357a11779,11781 +7357a11780,11782 > Patrizia/M > Patrizio/M > Patrizius/M -7358a11783 +7358a11784 > Patten/M -7360a11786,11787 +7360a11787,11788 > Pattie/M > Pattin/M -7364a11792,11793 +7364a11793,11794 > Paule/M > Pauletta/M -7366a11796,11797 +7366a11797,11798 > Paulie/M > Paulina/M -7367a11799,11801 +7367a11800,11802 > Paulita/M > Paulo/M > Pauly/M -7368a11803,11805 +7368a11804,11806 > Pavel/M > Pavia/M > Pavla/M -7372a11810,11811 +7372a11811,11812 > Paxon/M > Paxton -7375c11814 +7375c11815 < Paypal/M --- > Payton/M -7379a11819 +7379a11820 > Peadar/M -7380a11821 +7380a11822 > Pearce/M -7381a11823,11824 +7381a11824,11825 > Pearla/M > Pearle/M -7382a11826 +7382a11827 > Pearline/M -7384a11829 +7384a11830 > Pebrook/M -7388a11834 +7388a11835 > Peder/M -7392a11839,11841 +7392a11840,11842 > Pegeen/M > Peggi/M > Peggie/M -7395a11845 +7395a11846 > Peirce/M -7405c11855 +7405c11856 < Penelope/M --- > Penelopa/M -7408a11859,11860 +7408a11860,11861 > Penni/M > Pennie/M -7413a11866 +7413a11867 > Penrod/M -7422a11876,11878 +7422a11877,11879 > Pepe/M > Pepi/M > Pepillo/M -7423a11880,11881 +7423a11881,11882 > Pepita/M > Pepito/M -7426a11885 +7426a11886 > Perceval -7431a11891,11893 +7431a11892,11894 > Peri/M > Peria/M > Perice/M -7434c11896 +7434c11897 < Perkins --- > Perkin/MS -7435a11898,11899 +7435a11899,11900 > Perla/M > Perle/M -7438a11903 +7438a11904 > Pernell/M -7441a11907,11909 +7441a11908,11910 > Perren/M > Perri/M > Perrine/M -7449a11918 +7449a11919 > Persis -7453a11923,11924 +7453a11924,11925 > Pet > Peta/M -7458a11930,11932 +7458a11931,11933 > Peterus/M > Petey/M > Petr/M -7460a11935,11939 +7460a11936,11940 > Petrina/M > Petronella/M > Petronia/M > Petronilla/M > Petronille/M -7461a11941 +7461a11942 > Petunia/M -7462a11943,11944 +7462a11944,11945 > Peyter/M > Peyton/M -7467a11950 +7467a11951 > Phaidra/M -7473a11957,11958 +7473a11958,11959 > Phebe > Phedra/M -7474a11960 +7474a11961 > Phelia/M -7478a11965 +7478a11966 > Philbert/M -7481a11969,11970 +7481a11970,11971 > Philipa/M > Philippa/M -7484a11974 +7484a11975 > Philis/M -7485a11976,11977 +7485a11977,11978 > Phillida/M > Phillie/M -7487a11980,11982 +7487a11981,11983 > Phillipe/M > Phillipp/M > Phillis/M -7488a11984,11986 +7488a11985,11987 > Philomena/M > Phineas/M > Phip/M -7494a11993,11994 +7494a11994,11995 > Photoshopped > Photoshopping -7498a11999,12000 +7498a12000,12001 > Phylis/M > Phyllida/M -7499a12002,12004 +7499a12003,12005 > Phyllys/M > Phylys/M > Pia/M -7509a12015 +7509a12016 > Pictor -7510a12017 +7510a12018 > Pier/M -7511a12019 +7511a12020 > Pierette/M -7512a12021 +7512a12022 > Pierrette/M -7513a12023,12028 +7513a12024,12029 > Pierson/M > Pieter/M > Pietra/M > Pietrek/M > Pietro/M > Piggy/M -7520a12036,12037 +7520a12037,12038 > Pincas/M > Pinchas/M -7527a12045,12048 +7527a12046,12049 > Piotr/M > Pip/MR > Piper/M > Pippa/M -7528a12050,12051 +7528a12051,12052 > Pippo/M > Pippy/M -7559c12082 +7559c12083 < Pleiades's --- > Pleiades/M -7620a12144 +7620a12145 > Poppy/M -7626a12151 +7626a12152 > Portie/M -7631a12157 +7631a12158 > Porty/M -7639a12166 +7639a12167 > Poul/M -7647c12174 +7647c12175 < Pr/M --- > Pr/MN -7661a12189 +7661a12190 > Pren/M -7662a12191 +7662a12192 > Prent/M -7663a12193 +7663a12194 > Prentiss/M -7679a12210,12213 +7679a12211,12214 > Prinz > Pris > Prisca/M > Priscella/M -7680a12215 +7680a12216 > Prissie/M -7707a12243 +7707a12244 > Pru/M -7709a12246,12248 +7709a12247,12249 > Prudi/M > Prudy/M > Prue/M -7713a12253 +7713a12254 > Pryce/M -7727a12268 +7727a12269 > Puff/M -7751a12293 +7751a12294 > Putnem/M -7793a12336 +7793a12337 > Queenie/M -7795a12339 +7795a12340 > Quent/M -7796a12341 +7796a12342 > Querida/M -7798a12344,12346 +7798a12345,12347 > Quill/M > Quillan/M > Quincey/M -7799a12348 +7799a12349 > Quinlan/M -7800a12350,12352 +7800a12351,12353 > Quint/M > Quinta/M > Quintana/M -7801a12354,12356 +7801a12355,12357 > Quintilla/M > Quintin/M > Quintina/M -7802a12358 +7802a12359 > Quintus/M -7811c12367 +7811c12368 < R/MD --- > R/MGD -7841a12398 +7841a12399 > Rab/M -7842a12400 +7842a12401 > Rabbi/M -7844a12403 +7844a12404 > Rabi -7847a12407 +7847a12408 > Rachele/M -7850a12411 +7850a12412 > Rad/M -7851a12413,12414 +7851a12414,12415 > Raddie/M > Raddy/M -7852a12416,12418 +7852a12417,12419 > Raeann/M > Raf/M > Rafa/M -7853a12420,12429 +7853a12421,12430 > Rafaela/M > Rafaelia/M > Rafaelita/M @@ -7131,10 +7132,10 @@ > Raffaello/M > Raffarty/M > Rafferty/M -7854a12431,12432 +7854a12432,12433 > Rafi/M > Ragnar/M -7855a12434,12441 +7855a12435,12442 > Rahal/M > Rahel/M > Raimondo/M @@ -7143,74 +7144,74 @@ > Raina/M > Raine/MR > Rainer/M -7856a12443 +7856a12444 > Rakel/M -7857a12445,12446 +7857a12446,12447 > Ralf/M > Ralina/M -7858a12448 +7858a12449 > Ram -7869a12460 +7869a12461 > Ramonda/M -7873a12465,12467 +7873a12466,12468 > Rana/M > Rance/M > Rancell/M -7874a12469 +7874a12470 > Randa/M -7876a12472 +7876a12473 > Randee/M -7877a12474 +7877a12475 > Randene/M -7878a12476,12477 +7878a12477,12478 > Randie/M > Randolf/M -7880a12480 +7880a12481 > Ranee/M -7881a12482,12485 +7881a12483,12486 > Rani/M > Rania/M > Ranice/M > Ranique/M -7883a12488,12490 +7883a12489,12491 > Ranna/M > Ransell/M > Ransom/M -7885a12493 +7885a12494 > Raphaela/M -7887a12496 +7887a12497 > Raquela/M -7889a12499,12500 +7889a12500,12501 > Rasia/M > Rasla/M -7897a12509,12512 +7897a12510,12513 > Raven/M > Ravi/M > Ravid/M > Raviv/M -7898a12514 +7898a12515 > Rawley/M -7901a12518,12519 +7901a12519,12520 > Raychel/M > Raye/M -7903a12522 +7903a12523 > Raymund/M -7904a12524,12529 +7904a12525,12530 > Rayna/M > Raynard/M > Raynell/M > Rayner/M > Raynor/M > Rayshell/M -7907a12533,12535 +7907a12534,12536 > Rea/M > Read/GM > Reade -7910a12539 +7910a12540 > Reagen/M -7911a12541 +7911a12542 > Reamonn/M -7914c12544,12548 +7914c12545,12549 < Rebecca --- > Rebbecca/M @@ -7218,38 +7219,38 @@ > Rebeca/M > Rebecka/M > Rebeka/M -7915a12550 +7915a12551 > Rebekkah/M -7918a12554 +7918a12555 > Redd/M -7922a12559,12560 +7922a12560,12561 > Ree/DSM > Reeba/M -7923a12562 +7923a12563 > Reece/M -7924a12564 +7924a12565 > Reena/M -7925a12566,12567 +7925a12567,12568 > Reeta/M > Reeva/M -7928a12571,12574 +7928a12572,12575 > Reg/N > Regan/M > Regen/M > Reggi/MS -7929a12576 +7929a12577 > Reggy/M -7932a12580,12581 +7932a12581,12582 > Reginauld/M > Regine/M -7937c12586,12589 +7937c12587,12590 < Reid --- > Reid/R > Reidar/M > Reider/M > Reiko/M -7939c12591,12595 +7939c12592,12596 < Reinaldo/M --- > Reina/M @@ -7257,122 +7258,122 @@ > Reinaldo/SM > Reine/M > Reinhard/M -7941a12598,12602 +7941a12599,12603 > Reinold/M > Reinwald/M > Rem/M > Remanence/S > Remanent -7945a12607 +7945a12608 > Remy/M -7946a12609,12610 +7946a12610,12611 > Renado/M > Renae/M -7947a12612,12613 +7947a12613,12614 > Renaldo/M > Renard/M -7948a12615,12618 +7948a12616,12619 > Renata/M > Renate/M > Renato/M > Renaud/M -7951a12622,12625 +7951a12623,12626 > Renell/M > Renelle/M > Renie/M > Rennie/M -7961a12636,12638 +7961a12637,12639 > Reta/M > Retha/M > Reube/M -7965a12643 +7965a12644 > Reuven/M -7970a12649 +7970a12650 > Revkah/M -7972a12652 +7972a12653 > Rey/M -7977c12657,12658 +7977c12658,12659 < Reynolds --- > Reynard/M > Reynold/MS -7980a12662 +7980a12663 > Rheba/M -7983a12666,12670 +7983a12667,12671 > Rheta/M > Rhett/M > Rhetta/M > Rhiamon/M > Rhianna/M -7984a12672 +7984a12673 > Rhianon/M -7987a12676 +7987a12677 > Rhode -7990a12680,12683 +7990a12681,12684 > Rhodia/M > Rhodie/M > Rhody/M > Rhona/M -7992a12686,12689 +7992a12687,12690 > Rhys/M > Riane/M > Riannon/M > Rianon/M -7993a12691,12693 +7993a12692,12694 > Ric/M > Rica/M > Ricard/M -7994a12695,12696 +7994a12696,12697 > Ricca/M > Riccardo/M -7997a12700 +7997a12701 > Richardo/M -7998a12702 +7998a12703 > Richart/M -8001a12706 +8001a12707 > Richmound/M -8003a12709,12710 +8003a12710,12711 > Richy/M > Rici/M -8004a12712 +8004a12713 > Rickard/M -8005a12714 +8005a12715 > Rickert/M -8006a12716 +8006a12717 > Ricki/M -8010a12721 +8010a12722 > Ricoriki/M -8022a12734,12736 +8022a12735,12737 > Rik/M > Riki/M > Rikki/M -8025a12740,12742 +8025a12741,12743 > Rina/M > Rinaldo/M > Ring/M -8028a12746,12748 +8028a12747,12749 > Riobard/M > Riordan/M > Rip/M -8029a12750 +8029a12751 > Risa/M -8032a12754 +8032a12755 > Ritchie/M -8034c12756,12757 +8034c12757,12758 < Rivas --- > Riva/SM > Rivalee/M -8037a12761 +8037a12762 > Rivi/M -8038a12763,12764 +8038a12764,12765 > Rivkah/M > Rivy/M -8042a12769,12771 +8042a12770,12772 > Roana/M > Roanna/M > Roanne/M -8044c12773,12777 +8044c12774,12778 < Rob/M --- > Roarke/M @@ -7380,167 +7381,167 @@ > Robb/M > Robbert/M > Robbi/M -8047a12781,12784 +8047a12782,12785 > Robbyn/M > Robena/M > Robenia/M > Robers/M -8055a12793,12798 +8055a12794,12799 > Robina/M > Robinet/M > Robinett/M > Robinetta/M > Robinette/M > Robinia/M -8060a12804 +8060a12805 > Roby/M -8062a12807 +8062a12808 > Roch/M -8065a12811,12812 +8065a12812,12813 > Rochell/M > Rochella/M -8067a12815 +8067a12816 > Rochette/M -8069a12818 +8069a12819 > Rockey/M -8070a12820 +8070a12821 > Rockie/M -8075a12826,12827 +8075a12827,12828 > Roda/M > Rodd/M -8076a12829,12832 +8076a12830,12833 > Roddie/M > Roddy/M > Roderic/M > Roderich/M -8077a12834,12835 +8077a12835,12836 > Roderigo/M > Rodge/MZR -8078a12837,12839 +8078a12838,12840 > Rodham/M > Rodi/M > Rodie/M -8079a12841 +8079a12842 > Rodina/M -8081a12844,12845 +8081a12845,12846 > Rodolph/M > Rodolphe/M -8084a12849 +8084a12850 > Rodrique/M -8087a12853 +8087a12854 > Rog/MRZ -8089c12855 +8089c12856 < Roger/S --- > Rogerio/M -8090a12857 +8090a12858 > Roi/SM -8094a12862 +8094a12863 > Roldan/M -8095a12864,12866 +8095a12865,12867 > Roley/M > Rolf > Rolfe/M -8098c12869,12871 +8098c12870,12872 < Rollins --- > Rollie/M > Rollin/MS > Rollo -8099a12873 +8099a12874 > Rolph/M -8101a12876,12877 +8101a12877,12878 > Roma/M > Romain/M -8116a12893,12895 +8116a12894,12896 > Romola/M > Romona/M > Romonda/M -8117a12897 +8117a12898 > Romy/M -8118a12899 +8118a12900 > Rona/M -8119a12901 +8119a12902 > Ronalda/M -8120a12903,12906 +8120a12904,12907 > Ronica/M > Ronna/M > Ronni/M > Ronnica/M -8124a12911,12912 +8124a12912,12913 > Roobbie/M > Roomba/MS -8128a12917,12920 +8128a12918,12921 > Rora/M > Rori/M > Rorie/M > Rorke/M -8130a12923 +8130a12924 > Ros -8131a12925,12928 +8131a12926,12929 > Rosabel/M > Rosabella/M > Rosabelle/M > Rosaleen/M -8132a12930 +8132a12931 > Rosalia/M -8135a12934,12935 +8135a12935,12936 > Rosalinde/M > Rosaline/M -8136a12937,12940 +8136a12938,12941 > Rosalynd/M > Rosamond/M > Rosamund/M > Rosana/M -8139a12944 +8139a12945 > Rosco/M -8142a12948,12949 +8142a12949,12950 > Roseanna/M > Roseanne/M -8144a12952,12954 +8144a12953,12955 > Roselia/M > Roselin/M > Roseline/M -8145a12956,12957 +8145a12957,12958 > Roselle/M > Rosemaria/M -8147a12960 +8147a12961 > Rosemonde/M -8149a12963 +8149a12964 > Rosene/M -8151a12966,12967 +8151a12967,12968 > Rosette/M > Roshelle/M -8153a12970,12971 +8153a12971,12972 > Rosina/M > Rosita/M -8154a12973 +8154a12974 > Rosmunda/M -8156a12976 +8156a12977 > Rossie/M -8157a12978 +8157a12979 > Rossy/M -8161a12983 +8161a12984 > Rosy/M -8170a12993 +8170a12994 > Rouvin/M -8171a12995,12996 +8171a12996,12997 > Row/MN > Rowan/M -8172a12998 +8172a12999 > Rowen/M -8175a13002,13005 +8175a13003,13006 > Rowney/M > Roxana/M > Roxane/M > Roxanna/M -8176a13007 +8176a13008 > Roxi/M -8177a13009 +8177a13010 > Roxine/M -8180a13013 +8180a13014 > Royall/M -8181a13015,13023 +8181a13016,13024 > Roz/M > Rozalie/M > Rozalin/M @@ -7550,229 +7551,229 @@ > Roze/M > Rozele/M > Rozella/M -8182a13025,13026 +8182a13026,13027 > Rozina/M > Rriocard/M -8186a13031 +8186a13032 > Rube/M -8187a13033,13035 +8187a13034,13036 > Rubetta/M > Rubi/M > Rubia/M -8188a13037 +8188a13038 > Rubie/M -8190a13040 +8190a13041 > Rubina/M -8193a13044,13048 +8193a13045,13049 > Rudd/M > Ruddie/M > Ruddy/M > Rudie/M > Rudiger/M -8194a13050 +8194a13051 > Rudolfo/M -8197a13054 +8197a13055 > Rufe/M -8199a13057 +8199a13058 > Ruggiero/M -8209a13068,13071 +8209a13069,13072 > Ruperta/M > Ruperto/M > Ruprecht/M > Rurik -8220a13083,13084 +8220a13084,13085 > Rustie/M > Rustin/M -8223c13087 +8223c13088 < Rutgers --- > Rutger/MS -8224a13089,13091 +8224a13090,13092 > Ruthann/M > Ruthanne/M > Ruthe/M -8225a13093 +8225a13094 > Ruthi/M -8226a13095 +8226a13096 > Ruthy/M -8227a13097,13099 +8227a13098,13100 > Rutter/M > Ruttger/M > Ruy/M -8233a13106,13107 +8233a13107,13108 > Ryann/M > Rycca/M -8235a13110,13111 +8235a13111,13112 > Ryley/M > Ryon/M -8237c13113,13114 +8237c13114,13115 < S/MN --- > Ryun/M > S/MNY -8285a13163 +8285a13164 > Saba/M -8291a13170 +8291a13171 > Sabra -8295a13175 +8295a13176 > Sacha/M -8297a13178 +8297a13179 > Sada/M -8301a13183 +8301a13184 > Sadella/M -8303a13186 +8303a13187 > Sadye/M -8311a13195 +8311a13196 > Saidee/M -8322a13207 +8322a13208 > Salaidh/M -8325a13211 +8325a13212 > Saleem/M -8327a13214 +8327a13215 > Salim/M -8332a13220,13221 +8332a13221,13222 > Sallee/M > Salli/M -8335a13225,13228 +8335a13226,13229 > Sallyann/M > Sallyanne/M > Salmon/M > Saloma/M -8336a13230,13233 +8336a13231,13234 > Salomi/M > Salomo/M > Salomon/M > Salomone/M -8343a13241 +8343a13242 > Salvidor/M -8349a13248 +8349a13249 > Samaria -8362a13262 +8362a13263 > Samuele/M -8371a13272,13276 +8371a13273,13277 > Sande/MZR > Sander/M > Sanderson/M > Sandi/M > Sandie/M -8372a13278 +8372a13279 > Sandor/M -8374a13281 +8374a13282 > Sandro/M -8375a13283 +8375a13284 > Sandye/M -8382a13291,13292 +8382a13292,13293 > Sanson/M > Sansone/M -8388a13299,13300 +8388a13300,13301 > Sapphira > Sapphire/M -8391a13304 +8391a13305 > Saraann/M -8394a13308 +8394a13309 > Sarajane/M -8400a13315,13318 +8400a13316,13319 > Saree/M > Sarena/M > Sarene/M > Sarette/M -8401a13320 +8401a13321 > Sarge/M -8403a13323,13326 +8403a13324,13327 > Sari/M > Sarina/M > Sarine/M > Sarita/M -8407a13331 +8407a13332 > Sascha/M -8408a13333 +8408a13334 > Sashenka/M -8422a13348 +8422a13349 > Saudra/M -8424c13350,13352 +8424c13351,13353 < Saunders --- > Sauncho/M > Saunder/MS > Saunderson/M -8427a13356 +8427a13357 > Sauveur/M -8429a13359 +8429a13360 > Savina/M -8433a13364 +8433a13365 > Saw/M -8434a13366,13368 +8434a13367,13369 > Sawyere/M > Sax > Saxe/M -8437c13371,13373 +8437c13372,13374 < Sayers --- > Say/MRZ > Sayer/MS > Sayre/MS -8444a13381 +8444a13382 > Scarface/M -8445a13383,13384 +8445a13384,13385 > Scarlet/M > Scarlett/M -8498a13438 +8498a13439 > Scotti/M -8518a13459 +8518a13460 > Seamus/M -8519a13461 +8519a13462 > Seana/M -8522a13465,13466 +8522a13466,13467 > Sebastiano/M > Sebastien/M -8528a13473 +8528a13474 > See/M -8537a13483,13484 +8537a13484,13485 > Seka/M > Sela/M -8538a13486 +8538a13487 > Selby/M -8540a13489,13490 +8540a13490,13491 > Selene/M > Selestina/M -8542a13493,13495 +8542a13494,13496 > Selia/M > Selie/M > Selig/M -8543a13497,13499 +8543a13498,13500 > Selina/M > Selinda/M > Seline/M -8545a13502,13503 +8545a13503,13504 > Sella/M > Selle/MZ -8554a13513 +8554a13514 > Sena/M -8567a13527 +8567a13528 > Sephira/M -8571a13532 +8571a13533 > sequitur -8576a13538 +8576a13539 > Serene -8577a13540,13541 +8577a13541,13542 > Serge/M > Sergeant/M -8578a13543 +8578a13544 > Sergent/M -8585a13551 +8585a13552 > Seumas/M -8600a13567,13568 +8600a13568,13569 > Shadow/M > Shae/M -8601a13570,13571 +8601a13571,13572 > Shaina/M > Shaine/M -8605a13576,13579 +8605a13577,13580 > Shalna/M > Shalne/M > Shalom/M > Shamus/M -8606a13581,13587 +8606a13582,13588 > Shanan/M > Shanda/M > Shandee/M @@ -7780,36 +7781,36 @@ > Shandie/M > Shandra/M > Shandy/M -8608a13590,13591 +8608a13591,13592 > Shani/M > Shanie/M -8610a13594,13596 +8610a13595,13597 > Shannah/M > Shannan/M > Shannen/M -8611a13598,13600 +8611a13599,13601 > Shanon/M > Shanta/M > Shantee/M -8613a13603,13604 +8613a13604,13605 > Shara/M > Sharai/M -8615a13607 +8615a13608 > Sharia/M -8616a13609,13612 +8616a13610,13613 > Sharity/M > Sharl/M > Sharla/M > Sharleen/M -8617a13614 +8617a13615 > Sharline/M -8618a13616 +8618a13617 > Sharona/M -8621a13620 +8621a13621 > Sharyl/M -8622a13622 +8622a13623 > Shaughn/M -8631a13632,13638 +8631a13633,13639 > Shay/M > Shayla/M > Shaylah/M @@ -7817,74 +7818,74 @@ > Shaylynn/M > Shayna/M > Shayne/M -8635a13643,13645 +8635a13644,13646 > Sheela/M > Sheelagh/M > Sheelah/M -8636a13647 +8636a13648 > Sheeree/M -8637a13649,13650 +8637a13650,13651 > Sheff/M > Sheffie/M -8638a13652 +8638a13653 > Sheffy/M -8639a13654,13659 +8639a13655,13660 > Sheilah/M > Shel/MY > Shela/M > Shelagh/M > Shelba/M > Shelbi/M -8640a13661 +8640a13662 > Shelden/M -8644a13666,13667 +8644a13667,13668 > Shelli/M > Shellie/M -8646a13670,13671 +8646a13671,13672 > Shem/M > Shena/M -8649a13675 +8649a13676 > Shep/M -8652a13679,13680 +8652a13680,13681 > Shepperd/M > Sher/M -8657a13686,13689 +8657a13687,13690 > Sherie/M > Sherill/M > Sherilyn/M > Sherline/M -8658a13691,13692 +8658a13692,13693 > Sherlocke/M > Sherm/M -8659a13694,13695 +8659a13695,13696 > Shermie/M > Shermy/M -8663a13700 +8663a13701 > Sherwin/M -8664a13702,13703 +8664a13703,13704 > Sherwynd/M > Sherye/M -8675a13715 +8675a13716 > Shina/M -8678a13719 +8678a13720 > Shir/M -8679a13721,13724 +8679a13722,13725 > Shirl/M > Shirlee/M > Shirleen/M > Shirlene/M -8680a13726 +8680a13727 > Shirline/M -8682a13729 +8682a13730 > Sholom/M -8684a13732,13733 +8684a13733,13734 > Shoshana/M > Shoshanna/M -8692a13742,13744 +8692a13743,13745 > Shurlock/M > Shurlocke/M > Shurwood/M -8698a13751,13757 +8698a13752,13758 > Siana/M > Sianna/M > Sib/M @@ -7892,245 +7893,245 @@ > Sibby/M > Sibeal/M > Sibel/M -8699a13759,13760 +8699a13760,13761 > Sibella/M > Sibelle/M -8701a13763,13764 +8701a13764,13765 > Sibilla/M > Sibley/M -8702a13766,13767 +8702a13767,13768 > Sibylla/M > Sibylle/M -8706a13772 +8706a13773 > Sidnee/M -8707a13774,13776 +8707a13775,13777 > Sidoney/M > Sidonia/M > Sidonnie/M -8711a13781,13786 +8711a13782,13787 > Siffre/M > Sig > Sigfrid/M > Sigfried/M > Sigismond/M > Sigismondo/M -8712a13788 +8712a13789 > Sigismundo/M -8713a13790 +8713a13791 > Sigrid/M -8714a13792 +8714a13793 > Sigvard/M -8722a13801,13802 +8722a13802,13803 > Sile/M > Sileas/M -8725a13806,13811 +8725a13807,13812 > Silvain/M > Silvan/M > Silvana/M > Silvano/M > Silvanus/M > Silvester/M -8726a13813,13815 +8726a13814,13816 > Silvie/M > Silvio/M > Sim/SM -8727a13817 +8727a13818 > Simeon/M -8728a13819 +8728a13820 > Simmonds/M -8730a13822 +8730a13823 > Simona/M -8731a13824,13825 +8731a13825,13826 > Simonette/M > Simonne/M -8736a13831 +8736a13832 > Sinclare/M -8737a13833 +8737a13834 > Sindee/M -8745a13842 +8745a13843 > Siobhan/M -8746a13844 +8746a13845 > Siouxie/M -8748a13847,13850 +8748a13848,13851 > Sisely/M > Sisile/M > Sissie/M > Sissy/M -8752a13855 +8752a13856 > Siusan/M -8754a13858 +8754a13859 > Siward/M -8755a13860,13861 +8755a13861,13862 > Skell/M > Skelly/M -8756a13863,13866 +8756a13864,13867 > Skip/M > Skipp/MR > Skipper/M > Skippie/M -8757a13868 +8757a13869 > Skipton/M -8758a13870 +8758a13871 > Sky/M -8760a13873,13874 +8760a13874,13875 > Skylar/M > Skyler/M -8762a13877 +8762a13878 > Slade/M -8778a13894 +8778a13895 > Sly/M -8785a13902 +8785a13903 > Smitty/M -8809a13927 +8809a13928 > Sofie/M -8811c13929 +8811c13930 < Sol/M --- > Sol/MY -8812a13931,13932 +8812a13932,13933 > Sollie/M > Solly/M -8818a13939 +8818a13940 > Somerset -8827a13949,13951 +8827a13950,13952 > Sonni/M > Sonnie/M > Sonnnie/M -8832a13957,13958 +8832a13958,13959 > Sophey/M > Sophi/M -8836a13963 +8836a13964 > Sophronia/M -8838a13966 +8838a13967 > Sorcha/M -8839a13968 +8839a13969 > Sosanna/M -8847c13976 +8847c13977 < Southerner/M --- > Southerner/SM -8875a14005 +8875a14006 > Spense/RM -8881a14012 +8881a14013 > Spike/M -8903a14035,14036 +8903a14036,14037 > Stace/M > Stacee/M -8905a14039 +8905a14040 > Stacia/M -8908a14043,14044 +8908a14044,14045 > Stafani/M > Staffard/M -8909a14046 +8909a14047 > Staford/M -8916c14053,14054 +8916c14054,14055 < Stan/M --- > Stan/MY > Standford/M -8917a14056 +8917a14057 > Stanfield/M -8918a14058,14059 +8918a14059,14060 > Stanislas/M > Stanislaus/M -8919a14061,14062 +8919a14062,14063 > Stanislaw/M > Stanleigh/M -8920a14064 +8920a14065 > Stanly/M -8921a14066 +8921a14067 > Stanwood/M -8922a14068 +8922a14069 > Star/M -8925a14072,14074 +8925a14073,14075 > Starla/M > Starlene/M > Starlin/M -8929a14079 +8929a14080 > Stavro/MS -8933a14084,14085 +8933a14085,14086 > Stearn/M > Stearne/M -8934a14087 +8934a14088 > Stefa/M -8935a14089 +8935a14090 > Stefania/M -8936a14091,14095 +8936a14092,14096 > Stefano/M > Steffane/M > Steffen/M > Steffi/M > Steffie/M -8944a14104 +8944a14105 > Stepha/M -8945a14106,14107 +8945a14107,14108 > Stephana/M > Stephani/M -8946a14109,14110 +8946a14110,14111 > Stephannie/M > Stephanus/M -8947a14112 +8947a14113 > Stephenie/M -8948a14114,14116 +8948a14115,14117 > Stephi/M > Stephie/M > Stephine/M -8952a14121 +8952a14122 > Stesha/M -8954a14124 +8954a14125 > Stevana/M -8956a14127 +8956a14128 > Stevena/M -8958a14130,14131 +8958a14131,14132 > Stevy/M > Steward/M -8960a14134,14135 +8960a14135,14136 > Stillman/M > Stillmann/M -8963a14139 +8963a14140 > Stinky/M -8967a14144 +8967a14145 > Stoddard/M -8975a14153,14156 +8975a14154,14157 > Storm/M > Stormi/M > Stormie/M > Stormy/M -9007a14189 +9007a14190 > Suellen/M -9015a14198,14199 +9015a14199,14200 > Sukey/M > Suki/M -9018a14203 +9018a14204 > Sula/M -9022a14208 +9022a14209 > Sully -9039a14226 +9039a14227 > Sunny/M -9040a14228 +9040a14229 > Sunshine/M -9055a14244,14245 +9055a14245,14246 > Susanetta/M > Susann/M -9056a14247 +9056a14248 > Susannah/M -9057a14249,14250 +9057a14250,14251 > Susette/M > Susi/M -9060a14254,14255 +9060a14255,14256 > Susy/M > Sutherlan/M -9064a14260,14261 +9064a14261,14262 > Suzann/M > Suzanna/M -9067a14265,14266 +9067a14266,14267 > Suzi/M > Suzie/M -9071a14271 +9071a14272 > Svend/M -9087a14288 +9087a14289 > Swen/M -9094a14296,14302 +9094a14297,14303 > Sybila/M > Sybilla/M > Sybille/M @@ -8138,19 +8139,19 @@ > Syd/M > Sydel/M > Sydelle/M -9096a14305,14306 +9096a14306,14307 > Sylas/M > Sylvan/M -9099a14310,14311 +9099a14311,14312 > Syman/M > Symon/M -9120a14333 +9120a14334 > TEirtza/M -9121a14335 +9121a14336 > THz/M -9135a14350 +9135a14351 > Tab/MR -9137a14353,14359 +9137a14354,14360 > Tabb/M > Tabbatha/M > Tabbi/M @@ -8158,11 +8159,11 @@ > Tabbitha/M > Tabby/M > Taber/M -9138a14361 +9138a14362 > Tabina/M -9139a14363 +9139a14364 > Tabor -9143a14368,14374 +9143a14369,14375 > Tadd/M > Taddeo/M > Taddeusz/M @@ -8170,245 +8171,245 @@ > Tadeo/M > Tades > Tadio/M -9147a14379 +9147a14380 > Taffy/M -9155a14388 +9155a14389 > Tailor/M -9159a14393,14394 +9159a14394,14395 > Tait/M > Taite/M -9164a14400 +9164a14401 > Talbert/M -9165a14402 +9165a14403 > Talia/M -9171a14409,14410 +9171a14410,14411 > Tallia/M > Tallie/M -9172a14412,14414 +9172a14413,14415 > Tallou/M > Tallulah/M > Tally/M -9175a14418,14421 +9175a14419,14422 > Talya/M > Talyah/M > Tam/M > Tamar/M -9176a14423,14425 +9176a14424,14426 > Tamarah/M > Tamarra/M > Tamas -9181a14431 +9181a14432 > Tamiko/M -9182a14433 +9182a14434 > Tamma/M -9183a14435 +9183a14436 > Tammara/M -9189a14442 +9189a14443 > Tamqrah/M -9191a14445,14446 +9191a14446,14447 > Tan > Tana -9192a14448,14450 +9192a14449,14451 > Tandi/M > Tandie/M > Tandy/M -9196a14455,14456 +9196a14456,14457 > Tanhya/M > Tani/M -9198a14459,14460 +9198a14460,14461 > Tanitansy/M > Tann/MR -9199a14462 +9199a14463 > Tanney/M -9200a14464,14466 +9200a14465,14467 > Tannie/M > Tanny/M > Tansy/M -9208a14475 +9208a14476 > Tarah/M -9216a14484,14486 +9216a14485,14487 > Tarra/M > Tarrah/M > Tarrance/M -9219a14490 +9219a14491 > Taryn/M -9222a14494 +9222a14495 > Tasia/M -9228a14501,14502 +9228a14502,14503 > Tatiana/M > Tatiania/M -9231a14506,14507 +9231a14507,14508 > Tawnya/M > Tawsha/M -9239a14516 +9239a14517 > Teador/M -9243a14521,14524 +9243a14522,14525 > Tedd/M > Tedda/M > Teddi/M > Teddie/M -9244a14526,14531 +9244a14527,14532 > Tedi/M > Tedie/M > Tedman/M > Tedmund/M > Tedra/M > Teena/M -9255a14543 +9255a14544 > Temp/M -9257a14546,14547 +9257a14547,14548 > Temple/M > Templeton/M -9262a14553,14557 +9262a14554,14558 > Teodoor/M > Teodor/M > Teodora/M > Teodorico/M > Teodoro/M -9263a14559 +9263a14560 > Tera/M -9264a14561 +9264a14562 > Terencio/M -9265a14563 +9265a14564 > Terese/M -9266a14565,14567 +9266a14566,14568 > Teresina > Teresita/M > Teressa/M -9267a14569 +9267a14570 > Teriann/M -9273a14576 +9273a14577 > Terrel/M -9277a14581,14582 +9277a14582,14583 > Terrijo/M > Terrill/M -9280a14586,14587 +9280a14587,14588 > Terrye/M > Tersina/M -9281a14589 +9281a14590 > Terza/M -9284a14593 +9284a14594 > Tessi/M -9285a14595 +9285a14596 > Tessy/M -9296a14607 +9296a14608 > Thacher/M -9299a14611,14612 +9299a14612,14613 > Thaddus/M > Thadeus/M -9301a14615,14616 +9301a14616,14617 > Thain/M > Thaine/M -9304a14620 +9304a14621 > Thane/M -9310c14626,14629 +9310c14627,14630 < Thatcher --- > Thatch/MR > Thatcherism > Thaxter/M > Thayne/M -9311a14631,14632 +9311a14632,14633 > Theadora/M > Thebault/M -9312a14634,14636 +9312a14635,14637 > Theda/M > Thedric/M > Thedrick/M -9313a14638 +9313a14639 > Thekla/M -9315a14641,14643 +9315a14642,14644 > The > Theo/M > Theobald/M -9316a14645 +9316a14646 > Theodor/M -9319a14649 +9319a14650 > Theodosia/M -9324a14655,14658 +9324a14656,14659 > Theresina/M > Theresita/M > Theressa/M > Therine/M -9333a14668,14670 +9333a14669,14671 > Thia/M > Thibaud/M > Thibaut/M -9336a14674,14675 +9336a14675,14676 > Thom/M > Thoma/SM -9337a14677,14680 +9337a14678,14681 > Thomasa/M > Thomasin/M > Thomasina/M > Thomasine/M -9344a14688,14691 +9344a14689,14692 > Thorin/M > Thorn > Thorndike > Thornie/M -9345a14693 +9345a14694 > Thorny/M -9347a14696,14698 +9347a14697,14699 > Thorstein/M > Thorsten/M > Thorvald/M -9354d14704 +9354d14705 < Thunderbird/M -9359a14710,14711 +9359a14711,14712 > Thurstan/M > Thurston/M -9367a14720 +9367a14721 > Tibold/M -9370a14724,14726 +9370a14725,14727 > Tiebold/M > Tiebout/M > Tiena/M -9372a14729,14733 +9372a14730,14734 > Tierney/M > Tiertza/M > Tiff/M > Tiffani/M > Tiffanie/M -9373a14735,14737 +9373a14736,14738 > Tiffi/M > Tiffie/M > Tiffy/M -9375a14740,14744 +9375a14741,14745 > Tilda/M > Tildi/M > Tildie/M > Tildy/M > Tiler/M -9376a14746 +9376a14747 > Tillie/M -9377a14748 +9377a14749 > Tilly/M -9381a14753,14755 +9381a14754,14756 > Timi/M > Timmi/M > Timmie/M -9382a14757 +9382a14758 > Timofei/M -9384a14760,14763 +9384a14761,14764 > Timoteo/M > Timothea/M > Timothee/M > Timotheus/M -9388a14768 +9388a14769 > Tine/M -9393a14774,14776 +9393a14775,14777 > Tiphani/M > Tiphanie/M > Tiphany/M -9400a14784,14785 +9400a14785,14786 > Tirrell/M > Tish/M -9408c14793 +9408c14794 < Tito/M --- > Tito/SM -9414a14800,14806 +9414a14801,14807 > Tobe/M > Tobey > Tobi/M @@ -8416,147 +8417,147 @@ > Tobias/M > Tobie/M > Tobin/M -9416a14809 +9416a14810 > Tobye/M -9420a14814,14815 +9420a14815,14816 > Toddie/M > Toddy/M -9422a14818,14819 +9422a14819,14820 > Toiboid/M > Toinette/M -9434c14831,14834 +9434c14832,14835 < Tomas --- > Toma/SM > Tomasina/M > Tomasine/M > Tomaso/M -9435a14836,14838 +9435a14837,14839 > Tome/M > Tomi/M > Tomkin/M -9436a14840 +9436a14841 > Tommi/M -9444a14849,14850 +9444a14850,14851 > Tonie/M > Tonnie/M -9447a14854,14855 +9447a14855,14856 > Tonye/M > Tootsie/M -9451a14860,14864 +9451a14861,14865 > Tore/M > Torey/M > Tori/M > Torie/M > Torin/M -9453a14867 +9453a14868 > Torr/MX -9454a14869,14870 +9454a14870,14871 > Torre/SM > Torrence/M -9456a14873 +9456a14874 > Torrey/M -9457a14875,14877 +9457a14876,14878 > Torrie/M > Torrin/M > Torry/M -9466a14887,14889 +9466a14888,14890 > Tova/M > Tove/M > Town/M -9467a14891,14892 +9467a14892,14893 > Towney/M > Townie/M -9468a14894 +9468a14895 > Towny/M -9471a14898,14899 +9471a14899,14900 > Trace/M > Tracee/M -9483a14912 +9483a14913 > Traver/MS -9485a14915 +9485a14916 > Travus/M -9487a14918 +9487a14919 > Trefor/M -9488a14920,14923 +9488a14921,14924 > Tremain/M > Tremaine/M > Tremayne/M > Trenna/M -9490a14926,14930 +9490a14927,14931 > Tresa/M > Trescha/M > Tressa/M > Trev/MR > Trevar/M -9491a14932 +9491a14933 > Trever/M -9504a14946 +9504a14947 > Trip/M -9506a14949 +9506a14950 > Tripp/M -9507a14951,14952 +9507a14952,14953 > Tris > Trish/M -9508a14954,14955 +9508a14955,14956 > Trista/M > Tristam/M -9510a14958,14961 +9510a14959,14962 > Trix/M > Trixi/M > Trixie/M > Trixy/M -9518a14970 +9518a14971 > Trstram/M -9519a14972,14973 +9519a14973,14974 > Truda/M > Trude/M -9520a14975,14977 +9520a14976,14978 > Trudey/M > Trudi/M > Trudie/M -9521a14979 +9521a14980 > Trueman/M -9523a14982,14983 +9523a14983,14984 > Trula/M > Trumaine/M -9524a14985 +9524a14986 > Trumann/M -9537a14999 +9537a15000 > Tuck/R -9538a15001,15002 +9538a15002,15003 > Tuckie/M > Tucky/M -9546a15011,15012 +9546a15012,15013 > Tulley/M > Tully/M -9590a15057 +9590a15058 > Twyla/M -9591a15059,15061 +9591a15060,15062 > Tybalt/M > Tybi/M > Tybie/M -9592a15063 +9592a15064 > Tye/M -9594a15066,15068 +9594a15067,15069 > Tymon/M > Tymothy/M > Tynan/M -9596a15071 +9596a15072 > Tyne/M -9601a15077 +9601a15078 > Tyrus/M -9609a15086 +9609a15087 > UI/MS -9638a15116 +9638a15117 > Udale/M -9639a15118 +9639a15119 > Udell/M -9642a15122 +9642a15123 > Ugo/M -9646a15127 +9646a15128 > Ula/M -9647a15129,15139 +9647a15130,15140 > Ulberto/M > Ulick/M > Ulises/M @@ -8568,238 +8569,238 @@ > Ulrika/M > Ulrikaumeko/M > Ulrike/M -9651a15144 +9651a15145 > Umberto/M -9652a15146,15147 +9652a15147,15148 > Umeko/M > Una/M -9672a15168 +9672a15169 > Urbain/M -9673a15170,15171 +9673a15171,15172 > Urbano/M > Urbanus/M -9675a15174 +9675a15175 > Uri/SM -9680a15180,15182 +9680a15181,15183 > Ursala/M > Ursola/M > Urson/M -9681a15184 +9681a15185 > Ursulina/M -9687a15191 +9687a15192 > Uta/M -9723a15228,15229 +9723a15229,15230 > Vachel/M > Vaclav/M -9726c15232,15235 +9726c15233,15236 < Val/M --- > Vail/M > Val/MY > Valaree/M > Valaria/M -9727a15237 +9727a15238 > Valdemar/M -9728a15239,15240 +9728a15240,15241 > Vale/M > Valeda/M -9729a15242,15243 +9729a15243,15244 > Valene/M > Valenka/M -9730a15245,15246 +9730a15246,15247 > Valentia/M > Valentijn/M -9731a15248 +9731a15249 > Valentina/M -9734a15252 +9734a15253 > Valera -9738a15257 +9738a15258 > Valerye/M -9739a15259,15260 +9739a15260,15261 > Valida/M > Valina/M -9741a15263 +9741a15264 > Valle/M -9743a15266,15269 +9743a15267,15270 > Valli/M > Vallie/M > Vally/M > Valma/M -9745a15272 +9745a15273 > Valry/M -9749a15277 +9749a15278 > Vanda/M -9754a15283,15287 +9754a15284,15288 > Vania/M > Vanna/M > Vanni/M > Vannie/M > Vanny/M -9755a15289 +9755a15290 > Vanya/M -9760a15295,15296 +9760a15296,15297 > Vasili/MS > Vasily/M -9762a15299,15300 +9762a15300,15301 > Vassili/M > Vassily/M -9780a15319 +9780a15320 > Velvet/M -9784a15324 +9784a15325 > Venita/M -9790a15331 +9790a15332 > Veradis -9793a15335,15338 +9793a15336,15339 > Vere/M > Verena/M > Verene/M > Verge/M -9794a15340,15343 +9794a15341,15344 > Veriee/M > Verile/M > Verina/M > Verine/M -9795a15345 +9795a15346 > Verla/M -9800c15350 +9800c15351 < Vern/M --- > Vern/MN -9802a15353,15355 +9802a15354,15356 > Vernen/M > Verney/M > Vernice/M -9803a15357 +9803a15358 > Vernor/M -9806a15361,15363 +9806a15362,15364 > Veronika/M > Veronike/M > Veronique -9813a15371,15372 +9813a15372,15373 > Vevay/M > Vi/M -9818a15378 +9818a15379 > Vick/M -9822a15383 +9822a15384 > Victoir/M -9827a15389 +9827a15390 > Vida/M -9828a15391,15392 +9828a15392,15393 > Vidovic/M > Vidovik/M -9837a15402 +9837a15403 > Viki/M -9838a15404,15405 +9838a15405,15406 > Vikki/M > Vikky/M -9839a15407 +9839a15408 > Vilhelmina/M -9845a15414,15415 +9845a15415,15416 > Vin/M > Vina/M -9847c15417,15419 +9847c15418,15420 < Vincent/M --- > Vincent/MS > Vincenty/M > Vincenz/M -9848a15421,15424 +9848a15422,15425 > Vinita/M > Vinni/M > Vinnie/M > Vinny/M -9850a15427,15428 +9850a15428,15429 > Violante/M > Viole/M -9851a15430,15432 +9851a15431,15433 > Violetta/M > Violette/M > Virge/M -9853a15435,15436 +9853a15436,15437 > Virgilio/M > Virgina/M -9855a15439 +9855a15440 > Virginie/M -9863a15448,15450 +9863a15449,15451 > Vita/M > Vite/M > Vitia/M -9865a15453,15455 +9865a15454,15456 > Vitoria > Vittoria/M > Vittorio/M -9866a15457,15458 +9866a15458,15459 > Viv/M > Viva/M -9868a15461,15462 +9868a15462,15463 > Vivi/MN > Vivia/M -9869a15464,15469 +9869a15465,15470 > Viviana/M > Vivianna/M > Vivianne/M > Vivie/M > Vivien/M > Viviene/M -9870a15471,15473 +9870a15472,15474 > Viviyan/M > Vivyan/M > Vivyanne/M -9871a15475 +9871a15476 > Vladamir/M -9885a15490 +9885a15491 > Von/M -9887a15493,15495 +9887a15494,15496 > Vonni/M > Vonnie/M > Vonny/M -9895a15504 +9895a15505 > Vyky/M -9899c15508 +9899c15509 < WASP/M --- > WASP/SM -9917a15527 +9917a15528 > Wadsworth/M -9921a15532,15534 +9921a15533,15535 > Wain/M > Wainwright/M > Wait/MR -9922a15536 +9922a15537 > Waiter/M -9923a15538 +9923a15539 > Wakefield -9930a15546 +9930a15547 > Waldon/M -9938a15555,15556 +9938a15556,15557 > Wallache/M > Wallas/M -9939a15558 +9939a15559 > Wallie/M -9940a15560 +9940a15561 > Walliw/M -9941a15562 +9941a15563 > Wally/M -9945a15567 +9945a15568 > Walther/M -9946a15569 +9946a15570 > Waly/M -9948a15572,15574 +9948a15573,15575 > Wandie/M > Wandis/M > Waneta/M -9949a15576 +9949a15577 > Wanids/M -9951c15578,15579 +9951c15579,15580 < Ward --- > Ward/N > Warde/M -9963d15590 +9963d15591 < Wasp -9964a15592 +9964a15593 > Wat/MZ -9976a15605,15612 +9976a15606,15613 > Waverley/M > Waverly/M > Way/M @@ -8808,207 +8809,207 @@ > Waylen/M > Waylin/M > Waylon/M -9989a15626,15627 +9989a15627,15628 > Weidar/M > Weider/M -9995a15634,15635 +9995a15635,15636 > Welbie/M > Welby/M -10006a15647,15650 +10006a15648,15651 > Wenda/M > Wendall/M > Wendel/M > Wendeline/M -10008a15653 +10008a15654 > Wendie/M -10009a15655,15660 +10009a15656,15661 > Wendye/M > Wenona/M > Wenonah/M > Werner/M > Wernher/M > Wes -10015a15667,15668 +10015a15668,15669 > Westbrook/M > Westbrooke/M -10017a15671,15672 +10017a15672,15673 > Westleigh/M > Westley/M -10021a15677 +10021a15678 > Weylin/M -10031a15688 +10031a15689 > Whit -10032a15690 +10032a15691 > Whitby/M -10043a15702 +10043a15703 > Whittaker/M -10044a15704 +10044a15705 > Wiatt/M -10057a15718 +10057a15719 > Wilburt/M -10060a15722,15725 +10060a15723,15726 > Wilden/M > Wildon/M > Wileen/M > Wilek/M -10065a15731 +10065a15732 > Wilfrid/M -10067a15734,15735 +10067a15735,15736 > Wilhelmine > Wilie/M -10073a15742 +10073a15743 > Willabella/M -10074a15744 +10074a15745 > Willamina/M -10075a15746,15747 +10075a15747,15748 > Willdon/M > Willem/M -10076a15749,15752 +10076a15750,15753 > Willetta/M > Willette/M > Willey/M > Willi/MS -10080a15757 +10080a15758 > Willow/M -10081a15759 +10081a15760 > Willyt/M -10082a15761 +10082a15762 > Wilmar/M -10083a15763 +10083a15764 > Wilmette/M -10084a15765,15767 +10084a15766,15768 > Wilona/M > Wilone/M > Wilow/M -10086a15770 +10086a15771 > Wilt/M -10089a15774 +10089a15775 > Win/M -10093a15779 +10093a15780 > Windham/M -10097a15784 +10097a15785 > Windy/M -10098a15786 +10098a15787 > Winfield/M -10100a15789,15790 +10100a15790,15791 > Wini/M > Winifield/M -10102a15793,15796 +10102a15794,15797 > Winn/M > Winna/M > Winnah/M > Winne/M -10103a15798 +10103a15799 > Winni/M -10104a15800 +10104a15801 > Winnifred/M -10105a15802,15805 +10105a15803,15806 > Winny/M > Winona/M > Winonah/M > Winslow/M -10113a15814 +10113a15815 > Wit/M -10115a15817,15818 +10115a15818,15819 > Wittie/M > Witty/M -10123a15827,15828 +10123a15828,15829 > Wolfie/M > Wolfy/M -10133a15839,15840 +10133a15840,15841 > Woodie/M > Woodman -10136a15844 +10136a15845 > Woody/M -10144a15853 +10144a15854 > Worden/M -10147a15857,15859 +10147a15858,15860 > Worth > Worthington/M > Worthy/M -10153a15866 +10153a15867 > Wrennie/M -10159a15873 +10159a15874 > Wyatan/M -10163c15877 +10163c15878 < Wyeth --- > Wye/H -10164a15879,15881 +10164a15880,15882 > Wylma/M > Wyn/M > Wyndham/M -10165a15883,15885 +10165a15884,15886 > Wynne/M > Wynnie/M > Wynny/M -10177a15898 +10177a15899 > Xaviera/M -10178a15900 +10178a15901 > Xena/M -10181a15904 +10181a15905 > Xenos -10183a15907 +10183a15908 > Xever/M -10188a15913 +10188a15914 > Ximenez/M -10193a15919,15921 +10193a15920,15922 > Xylia/M > Xylina/M > Xymenes/M -10209a15938 +10209a15939 > Yalonda/M -10215a15945,15948 +10215a15946,15949 > Yanaton/M > Yance/M > Yancey/M > Yancy/M -10223a15957,15958 +10223a15958,15959 > Yard/M > Yardley/M -10225a15961,15962 +10225a15962,15963 > Yasmeen/M > Yasmin/M -10230a15968,15969 +10230a15969,15970 > Yehudi/M > Yehudit/M -10231a15971 +10231a15972 > Yelena/M -10241a15982,15985 +10241a15983,15986 > Yetta/M > Yettie/M > Yetty/M > Yevette/M -10245a15990,15991 +10245a15991,15992 > Ynes/M > Ynez/M -10250a15997,15999 +10250a15998,16000 > Yolande/M > Yolane/M > Yolanthe/M -10253c16002,16005 +10253c16003,16006 < York/M --- > Yorgo/MS > York/MR > Yorke/M > Yorker/M -10258a16011,16012 +10258a16012,16013 > Yoshi/M > Yoshiko/M -10262a16017 +10262a16018 > Yovonnda/M -10264a16020 +10264a16021 > Ysabel/M -10271a16028 +10271a16029 > Yul/M -10273a16031 +10273a16032 > Yulma/M -10276a16035 +10276a16036 > Yurik/M -10278a16038 +10278a16039 > Yvon/M -10280c16040,16045 +10280c16041,16046 < Z/SMNXT --- > Yvor/M @@ -9017,24 +9018,24 @@ > Zaccaria/M > Zach > Zacharia/SM -10281a16047 +10281a16048 > Zacharie/M -10282a16049 +10282a16050 > Zacherie/M -10283a16051,16052 +10283a16052,16053 > Zack/M > Zackariah/M -10284a16054 +10284a16055 > Zahara/M -10286a16057 +10286a16058 > Zak/M -10292a16064 +10292a16065 > Zandra/M -10293a16066 +10293a16067 > Zaneta/M -10300a16074 +10300a16075 > Zarah/M -10301a16076,16082 +10301a16077,16083 > Zared/M > Zaria/M > Zarla/M @@ -9042,31 +9043,31 @@ > Zealand/M > Zeb/M > Zebadiah/M -10302a16084,16085 +10302a16085,16086 > Zebulen/M > Zebulon/M -10303a16087 +10303a16088 > Zed/M -10307a16092 +10307a16093 > Zelda/M -10310a16096 +10310a16097 > Zena/M -10311a16098 +10311a16099 > Zenia/M -10315a16103 +10315a16104 > Zerk/M -10321a16110 +10321a16111 > Zia/M -10325a16115 +10325a16116 > Zilvia/M -10333a16124,16125 +10333a16125,16126 > Zita/M > Zitella/M -10336a16129 +10336a16130 > Zollie/M -10337a16131 +10337a16132 > Zolly/M -10339a16134,16141 +10339a16135,16142 > Zonda/M > Zondra/M > Zonnya/M @@ -9075,713 +9076,713 @@ > Zorana/M > Zorina/M > Zorine/M -10346a16149 +10346a16150 > Zsazsa/M -10350a16154 +10350a16155 > Zulema/M -10354a16159 +10354a16160 > Zuzana/M -10460a16266 +10460a16267 > abridgement/MS -10488a16295,16296 +10488a16296,16297 > absorbance/S > absorbancy/M -10516,10517c16324 +10516,10517c16325 < abuse's < abuse/EGVDS --- > abuse/EGVDSM -10665a16473 +10665a16474 > acknowledgement/MS -10709,10710c16517 +10709,10710c16518 < act's < act/ASDGV --- > act/ASDGVM -10721,10722c16528 +10721,10722c16529 < active's < active/IKY --- > active/IKYSM -10724d16529 +10724d16530 < actives -10727,10728c16532 +10727,10728c16533 < activity's/I < activity/AS --- > activity/ASIM -10774,10775c16578 +10774,10775c16579 < address's < address/AGDS --- > address/AGDSM -10824c16627 +10824c16628 < admin/S --- > admin/MS -10936a16740 +10936a16741 > advocator/SM -10937a16742 +10937a16743 > adware/MS -10979,10980c16784 +10979,10980c16785 < affect's < affect/EGVDS --- > affect/EGVDSM -10990,10991c16794 +10990,10991c16795 < affiliate's < affiliate/EGNDS --- > affiliate/EGNDSM -11045c16848 +11045c16849 < afterward --- > afterward/S -11073a16877 +11073a16878 > aggregator/SM -11393d17196 +11393d17197 < altho -11579a17383 +11579a17384 > analyses -11631c17435 +11631c17436 < anecdotal --- > anecdotal/Y -11750a17555,17556 +11750a17556,17557 > anonymization/SM > anonymize/DSG -11804c17610 +11804c17611 < anthropomorphizing --- > anthropomorphize/DSG -11983c17789 +11983c17790 < app/S --- > app/MS -12035,12036c17841 +12035,12036c17842 < appointment's/A < appointment/ESM --- > appointment/ESMA -12135a17941,17942 +12135a17942,17943 > archaeoastronomy/M > archaeologic -12137a17945,17947 +12137a17946,17948 > archaeology/M > archaeomagnetic > archaeomagnetism -12152c17962 +12152c17963 < archeological --- > archeological/Y -12214,12215c18024 +12214,12215c18025 < arm's < arm/EAGDS --- > arm/EAGDSM -12255,12256c18064 +12255,12256c18065 < arrangement's/E < arrangement/ASM --- > arrangement/ASME -12427,12428c18235 +12427,12428c18236 < assign's < assign/ALGDS --- > assign/ALGDSM -12432c18239 +12432c18240 < assignees --- > assignee/MS -12446,12447c18253 +12446,12447c18254 < associate's < associate/EDSGNV --- > associate/EDSGNVM -12491a18298,18300 +12491a18299,18301 > astroarchaeology/SM > astrobiology/M > astrobleme/S -12584,12585c18393 +12584,12585c18394 < attempt's < attempt/ASDG --- > attempt/ASDGM -12685c18493 +12685c18494 < auteur --- > auteur/MS -12713a18522 +12713a18523 > autocomplete/S -12754a18564 +12754a18565 > avant-garde -12827d18636 +12827d18637 < awol -12829a18639 +12829a18640 > axe/M -12969c18779 +12969c18780 < badge/MZDRS --- > badge/MZDRSG -13018,13019c18828 +13018,13019c18829 < balance's < balance/UDSG --- > balance/UDSGM -13079,13080c18888 +13079,13080c18889 < band's < band/ESGD --- > band/ESGDM -13149,13150c18957 +13149,13150c18958 < bar's < bar/ECUTS --- > bar/ECUTSM -13195,13196c19002 +13195,13196c19003 < bark's < bark/CSGD --- > bark/CSGDM -13249,13250c19055 +13249,13250c19056 < base's < base/CDRSLTG --- > base/CDRSLTGM -13843,13844c19648 +13843,13844c19649 < bind's < bind/AUGS --- > bind/AUGSM -13864a19669 +13864a19670 > biodiesel/M -14118,14119c19923 +14118,14119c19924 < block's < block/UGDS --- > block/UGDSM -14179a19984,19986 +14179a19985,19987 > bloviate/SGD > bloviation > bloviator/SM -14210d20016 +14210d20017 < blueing's -14356,14357c20162 +14356,14357c20163 < bolt's < bolt/USGD --- > bolt/USGDM -14434a20240 +14434a20241 > bookselling -14455,14456c20261 +14455,14456c20262 < boot's < boot/ASGD --- > boot/ASGDM -14501,14502c20306 +14501,14502c20307 < bosom's < bosom/US --- > bosom/USM -14522a20327 +14522a20328 > botnet/MS -14785,14786c20590 +14785,14786c20591 < brief's < brief/CSDTGJ --- > brief/CSDTGJM -14841c20645 +14841c20646 < broadcast/AMGS --- > broadcast/AMGSD -14956,14957c20760 +14956,14957c20761 < buckle's < buckle/UDSG --- > buckle/UDSGM -14986,14987c20789 +14986,14987c20790 < bug's < bug/CS --- > bug/CSM -15039,15040c20841 +15039,15040c20842 < bullshitter's < bullshitter/S! --- > bullshitter/SM! -15078,15079c20879 +15078,15079c20880 < bunk's < bunk/CDGS --- > bunk/CDGSM -15093,15094c20893 +15093,15094c20894 < burden's < burden/USGD --- > burden/USGDM -15211,15212c21010 +15211,15212c21011 < button's < button/USDG --- > button/USDGM -15230d21027 +15230d21028 < byelaw/SM -15383d21179 +15383d21180 < callisthenics/M -15430,15431c21226 +15430,15431c21227 < camp's < camp/CSTGD --- > camp/CSTGDM -15460a21256,21258 +15460a21257,21259 > cancelled/U > canceller/M > cancelling -15518,15519c21316 +15518,15519c21317 < cant's < cant/CZRDGS --- > cant/CZRDGSM -15559a21357 +15559a21358 > capita -15609c21407 +15609c21408 < caravanserai's --- > caravanserai/M -15629,15630d21426 +15629,15630d21427 < carburetter/SM < carburettor/SM -15701a21498 +15701a21499 > carnitas -15788d21584 +15788d21585 < cashpoint/S -15797d21592 +15797d21593 < cassino/M -15832a21628 +15832a21629 > catalyses -15940d21735 +15940d21736 < caviare/M -16013,16014c21808 +16013,16014c21809 < cent's < cent/AR --- > cent/ARM -16098,16099c21892 +16098,16099c21893 < chain's < chain/UGDS --- > chain/UGDSM -16231,16232c22024 +16231,16232c22025 < charter's < charter/ASGD --- > charter/ASGDM -16277c22069 +16277c22070 < check/AGMDS --- > check/AGMDSU -16327c22119 +16327c22120 < chemistry/M --- > chemistry/MS -16372c22164 +16372c22165 < chickenshit/S! --- > chickenshit/SM! -16404c22196 +16404c22197 < children --- > children/M -16488d22279 +16488d22280 < chlorophyl/M -16629,16630c22420 +16629,16630c22421 < cider's < cider/S --- > cider/MS -16651,16652c22441,22442 +16651,16652c22442,22443 < cipher's < cipher/CGDS --- > cipher/CGDSM > ciphertext/S -16702,16703c22492 +16702,16703c22493 < cite's < cite/IAGSD --- > cite/IAGSDM -16733,16735c22522 +16733,16735c22523 < claim's < claim/CKEAGDS < claimable --- > claim/CKEAGDSMB -16783,16784c22570 +16783,16784c22571 < clasp's < clasp/UGDS --- > clasp/UGDSM -16794,16796c22580 +16794,16796c22581 < classified's < classified/U < classifieds --- > classified/MSU -16918,16919c22702 +16918,16919c22703 < cloak's < cloak/USDG --- > cloak/USDGM -16930,16931c22713 +16930,16931c22714 < clog's < clog/US --- > clog/USM -16944,16946c22726 +16944,16946c22727 < close's < close/EIGTSD < closeable --- > close/EIGTSDMB -17072d22851 +17072d22852 < cocain/M -17102,17103c22881 +17102,17103c22882 < cocksucker's < cocksucker/S! --- > cocksucker/SM! -17117,17118c22895 +17117,17118c22896 < code's < code/CAGDS --- > code/CAGDSM -17195,17196c22972 +17195,17196c22973 < coil's/A < coil/UADGS --- > coil/UADGSM -17245,17246c23021 +17245,17246c23022 < collect's < collect/ASGVD --- > collect/ASGVDM -17301a23077,23078 +17301a23078,23079 > colonoscope/SM > colonoscopy/SM -17304,17305c23081 +17304,17305c23082 < color's < color/AEGDS --- > color/AEGDSM -17311,17313c23087 +17311,17313c23088 < colored's < colored/U < coloreds --- > colored/MSU -17351,17352c23125 +17351,17352c23126 < combine's < combine/ADSG --- > combine/ADSGM -17371c23144 +17371c23145 < comer's --- > comer/M -17376,17377c23149 +17376,17377c23150 < comfit's < comfit/ES --- > comfit/ESM -17412c23184 +17412c23185 < comment/GSMDR --- > comment/GSMDRZ -17428,17429c23200 +17428,17429c23201 < commission's < commission/ACGSD --- > commission/ACGSDM -17442,17443c23213 +17442,17443c23214 < commode's < commode/EIS --- > commode/EISM -17447,17448c23217 +17447,17448c23218 < common's < common/UPRYT --- > common/UPRYTM -17537,17538c23306 +17537,17538c23307 < compilation's < compilation/AS --- > compilation/ASM -17597,17598c23365 +17597,17598c23366 < compress's < compress/CGVDS --- > compress/CGVDSM -17657,17658c23424 +17657,17658c23425 < concert's < concert/ESDG --- > concert/ESDGM -17719,17720c23485 +17719,17720c23486 < condition's < condition/AGSD --- > condition/AGSDM -17755c23520 +17755c23521 < confer/S --- > confer/SB -17800a23566 +17800a23567 > conformant -17986,17987c23752 +17986,17987c23753 < construct's < construct/CADVGS --- > construct/CADVGSM -17991,17992c23756 +17991,17992c23757 < constructionist's < constructionist/CS --- > constructionist/CSM -18122,18123c23886 +18122,18123c23887 < control's < control/CS --- > control/CSM -18151d23913 +18151d23914 < convenor/S -18169,18170c23931 +18169,18170c23932 < convert's < convert/AGSD --- > convert/AGSDM -18199,18200c23960 +18199,18200c23961 < cook's < cook/ADGS --- > cook/ADGSM -18206c23966 +18206c23967 < cookie/M --- > cookie/SM -18294,18295c24054 +18294,18295c24055 < cork's < cork/UDGS --- > cork/UDGSM -18375a24135,24136 +18375a24136,24137 > corrigibility/IM > corrigible/I -18389a24151 +18389a24152 > corruptibly/I -18467a24230 +18467a24231 > could've -18487,18488c24250 +18487,18488c24251 < countenance's < countenance/EGDS --- > countenance/EGDSM -18542,18543c24304 +18542,18543c24305 < coup's < coup/AS --- > coup/ASM -18545,18546c24306 +18545,18546c24307 < couple's < couple/CUDSG --- > couple/CUDSGM -18581,18582c24341 +18581,18582c24342 < cover's < cover/AEUGDS --- > cover/AEUGDSM -18585,18586c24344 +18585,18586c24345 < covering's < coverings --- > covering/MS -18739,18740c24497 +18739,18740c24498 < creation's/K < creation/ASM --- > creation/ASMK -18816a24574 +18816a24575 > crimeware/M -18880,18881c24638 +18880,18881c24639 < cross's < cross/AUGTSD --- > cross/AUGTSDM -18972,18973c24729 +18972,18973c24730 < crust's < crust/ISDG --- > crust/ISDGM -18988,18989c24744 +18988,18989c24745 < crypt's < crypt/CS --- > crypt/CSM -18999a24755 +18999a24756 > cryptologist/MS -19000a24757 +19000a24758 > cryptosystem/S -19035a24793 +19035a24794 > cul-de-sac -19104,19105c24862 +19104,19105c24863 < cure's < cure/KZGBDRS --- > cure/KZGBDRSM -19119,19120c24876 +19119,19120c24877 < curl's < curl/UDGS --- > curl/UDGSM -19131,19133c24887 +19131,19133c24888 < current's < current/FAY < currents --- > current/FAYSM -19142,19143c24896 +19142,19143c24897 < cursive's < cursive/EAY --- > cursive/EAYM -19167,19168c24920 +19167,19168c24921 < cuss's < cuss/FEGSD --- > cuss/FEGSDM -19246c24998 +19246c24999 < cysteine --- > cysteine/M -19536a25289 +19536a25290 > decertify/DSGNX -19935a25689 +19935a25690 > dequeue/DSG -19999a25754 +19999a25755 > designated/U -20196,20197c25951,25952 +20196,20197c25952,25953 < dialog/SM < dialogue/SM --- > dialog/SMGD > dialogue/SMRGD -20220a25976 +20220a25977 > diatomaceous -20481a26238 +20481a26239 > disclose/DSG -20633a26391 +20633a26392 > dissentious -20695,20696c26453 +20695,20696c26454 < district's < district/AS --- > district/ASM -20768c26525 +20768c26526 < djinn's --- > djinn/M -20830c26587 +20830c26588 < dogie/M --- > dogie/SM -20850,20851c26607 +20850,20851c26608 < dole's < dole/FGDS --- > dole/FGDSM -20895a26652 +20895a26653 > donator/MS -20918,20919c26675 +20918,20919c26676 < door's < door/IS --- > door/ISM -20975,20976c26731 +20975,20976c26732 < double's < double/ADSG --- > double/ADSGM -21067,21068c26822 +21067,21068c26823 < draft's < draft/ASDG --- > draft/ASDGM -21282,21283c27036 +21282,21283c27037 < duct's < duct/CIFDG --- > duct/CIFDGM -21291,21292c27044 +21291,21292c27045 < due's < due/IS --- > due/ISM -21355,21356c27107 +21355,21356c27108 < duplicate's < duplicate/AGNDS --- > duplicate/AGNDSM -21367a27119 +21367a27120 > durian/SM -21468,21469c27220 +21468,21469c27221 < earth's < earth/UDYG --- > earth/UDYGM -21523,21524c27274 +21523,21524c27275 < echo's < echo/ADG --- > echo/ADGM -21587,21588c27337 +21587,21588c27338 < edit's < edit/ADGS --- > edit/ADGSM -21735,21736c27484 +21735,21736c27485 < elect's < elect/ASDGV --- > elect/ASDGVM -21820a27569 +21820a27570 > elicitor/MS -21864,21865c27613 +21864,21865c27614 < em's < em/S --- > em/SM -21992,21993c27740 +21992,21993c27741 < employ's < employ/ADGLS --- > employ/ADGLSM -22071a27819 +22071a27820 > encyclopaedia -22196a27945 +22196a27946 > enqueue/DSG -22508a28258,28259 +22508a28259,28260 > eschatological > eschatologist/SM -22556a28308 +22556a28309 > estoppel -22638c28390 +22638c28391 < euthanize --- > euthanize/DSG -22719a28472 +22719a28473 > exabyte/MS -22722,22724c28475,28478 +22722,22724c28476,28479 < exact/SPDRYTG < exacting/Y < exaction/M @@ -9790,52 +9791,52 @@ > exacta/S > exacting/YP > exaction/MS -22726a28481 +22726a28482 > exactor/MS -22947a28703 +22947a28704 > experimentalism -23165,23166c28921 +23165,23166c28922 < face's < face/ACSDG --- > face/ACSDGM -23207,23208d28961 +23207,23208d28962 < faecal < faeces/M -23215c28968 +23215c28969 < faggoting's --- > faggot/SMG -23238,23239c28991 +23238,23239c28992 < faithful's < faithful/UPY --- > faithful/UPYM -23278,23279c29030 +23278,23279c29031 < fame's < fame/D --- > fame/DM -23418a29170 +23418a29171 > faux -23589,23590c29341 +23589,23590c29342 < fetter's < fetter/USGD --- > fetter/USGDM -23690,23691c29441 +23690,23691c29442 < figure's < figure/FEGSD --- > figure/FEGSDM -23699,23700c29449 +23699,23700c29450 < file's/KC < file/CAKGDS --- > file/CAKGDSM -23701a29451 +23701a29452 > filesystem/MS -23708,23711c29458,29459 +23708,23711c29459,29460 < filing's < filings < fill's @@ -9843,644 +9844,644 @@ --- > filing/SM > fill/AIDGSM -23715,23716c29463 +23715,23716c29464 < filling's < filling/S --- > filling/SM -23733,23734c29480 +23733,23734c29481 < filtrate's < filtrate/IGNDS --- > filtrate/IGNDSM -23745,23746c29491 +23745,23746c29492 < finance's < finance/ADSG --- > finance/ADSGM -23755,23756c29500 +23755,23756c29501 < fine's/F < fine/CAFTGDS --- > fine/CAFTGDSM -23776,23777c29520 +23776,23777c29521 < finish's < finish/ADSG --- > finish/ADSGM -24131,24132c29874 +24131,24132c29875 < flower's < flower/CSDG --- > flower/CSDGM -24155c29897 +24155c29898 < fluidized --- > fluidize/DSG -24185,24186c29927 +24185,24186c29928 < flux's < flux/ADG --- > flux/ADGM -24217,24218c29958,29959 +24217,24218c29959,29960 < focus's < focus/ADSG --- > foci > focus/ADSGM -24223,24224c29964 +24223,24224c29965 < fog's < fog/CS --- > fog/CSM -24238,24239c29978 +24238,24239c29979 < fold's < fold/IAUSGD --- > fold/IAUSGDM -24414,24415c30153 +24414,24415c30154 < forest's < forest/ACGDS --- > forest/ACGDSM -24464,24465c30202 +24464,24465c30203 < form's < form/CAIFDGS --- > form/CAIFDGSM -24609,24610c30346 +24609,24610c30347 < franchise's < franchise/EDSG --- > franchise/EDSGM -24633,24634c30369 +24633,24634c30370 < fraud's < fraud/S --- > fraud/SM -24639,24640c30374 +24639,24640c30375 < fray's < fray/CDGS --- > fray/CDGSM -24681,24682c30415 +24681,24682c30416 < freeze's < freeze/UAGS --- > freeze/UAGSM -24684c30417 +24684c30418 < freezing's --- > freezing/M -24733,24734c30466 +24733,24734c30467 < friendly's < friendly/UTPR --- > friendly/UTPRM -24736d30467 +24736d30468 < frier/M -24752,24753c30483 +24752,24753c30484 < fringe's < fringe/IDSG --- > fringe/IDSGM -24771,24772c30501 +24771,24772c30502 < frock's < frock/CUS --- > frock/CUSM -24786,24787c30515 +24786,24787c30516 < front's < front/FSDG --- > front/FSDGM -24800,24801c30528 +24800,24801c30529 < frost's < frost/CSDG --- > frost/CSDGM -24855,24856c30582,30583 +24855,24856c30583,30584 < fucker/M! < fuckhead/S! --- > fucker/SM! > fuckhead/SM! -24860,24861c30587 +24860,24861c30588 < fuel's < fuel/ADGS --- > fuel/ADGSM -24941,24942c30667 +24941,24942c30668 < furl's < furl/UDGS --- > furl/UDGSM -24953d30677 +24953d30678 < furore/MS -24969,24970c30693 +24969,24970c30694 < fuse's/A < fuse/CAIFGDS --- > fuse/CAIFGDSM -25038,25039c30761 +25038,25039c30762 < gain's < gain/ADGS --- > gain/ADGSM -25051,25052c30773 +25051,25052c30774 < gale's < gale/AS --- > gale/ASM -25125c30846 +25125c30847 < gaolbird/S --- > gaolbirds -25169,25170c30890 +25169,25170c30891 < gas's < gas/CS --- > gas/CSM -25180d30899 +25180d30900 < gasolene/M -25190a30910 +25190a30911 > gastroenterologist/M -25262c30982 +25262c30983 < geezer/M --- > geezer/MS -25297,25298c31017 +25297,25298c31018 < generation's/C < generation/ASM --- > generation/ASMC -25327c31046 +25327c31047 < genomic --- > genomic/S -25462a31182 +25462a31183 > gigabit/MS -25464a31185,31187 +25464a31186,31188 > gigajoule/MS > gigapixel/MS > gigawatt/MS -25560d31282 +25560d31283 < glamourize/DSG -25674c31396 +25674c31397 < glycerine's --- > glycerine/M -25816,25817c31538 +25816,25817c31539 < gorge's < gorge/EDSG --- > gorge/EDSGM -25884,25885c31605 +25884,25885c31606 < grade's < grade/CADSG --- > grade/CADSGM -25905c31625 +25905c31626 < gram/MS --- > gram/KMS -25909d31628 +25909d31629 < gramme/SM -26063c31782,31783 +26063c31783,31784 < greybeard --- > grey/MDRTGSP > greybeard/SM -26066c31786 +26066c31787 < greyness --- > greyness/M -26246,26247d31965 +26246,26247d31966 < guerilla's < guerillas -26403,26404c32121 +26403,26404c32122 < habit's < habit/ISB --- > habit/ISBM -26432,26436d32148 +26432,26436d32149 < haemoglobin's < haemophilia/M < haemorrhage/DSMG < haemorrhoid/S < haemorrhoids/M -26555,26556c32267 +26555,26556c32268 < hand's < hand/UDGS --- > hand/UDGSM -26702,26703c32413 +26702,26703c32414 < harness's < harness/UDSG --- > harness/UDSGM -26888,26889c32598 +26888,26889c32599 < hearse's < hearse/AS --- > hearse/ASM -26915,26916c32624 +26915,26916c32625 < heat's < heat/ADGS --- > heat/ADGSM -27167c32875 +27167c32876 < hexane --- > hexane/SM -27256,27257c32964 +27256,27257c32965 < hinge's < hinge/UDSG --- > hinge/UDSGM -27273a32981 +27273a32982 > hippopotami -27276,27277c32984 +27276,27277c32985 < hire's < hire/AGDS --- > hire/AGDSM -27302,27303c33009 +27302,27303c33010 < hitch's < hitch/UDSG --- > hitch/UDSGM -27512,27513c33218 +27512,27513c33219 < hook's < hook/UDSG --- > hook/UDSGM -27575,27576c33280 +27575,27576c33281 < horse's < horse/UDSG --- > horse/UDSGM -27666,27667c33370 +27666,27667c33371 < house's < house/ADSG --- > house/ADSGM -27841c33544 +27841c33545 < hurrah's --- > hurrah/M -27875d33577 +27875d33578 < hyaena/SM -27883,27884c33585 +27883,27884c33586 < hydrate's < hydrate/CGNDS --- > hydrate/CGNDSM -28017c33718 +28017c33719 < iPod/M --- > iPod/MS -28029,28030c33730 +28029,28030c33731 < ice's < ice/CDSG --- > ice/CDSGM -28105a33806 +28105a33807 > idolator/SM -28227c33928 +28227c33929 < immerse/XDSGN --- > immerse/XDSGNV -28513c34214 +28513c34215 < inbound --- > inbound/s -28531,28532c34232 +28531,28532c34233 < incentive's < incentive/ES --- > incentive/ESM -28560,28561c34260 +28560,28561c34261 < incline's < incline/EGDS --- > incline/EGDSM -28590,28591c34289 +28590,28591c34290 < incorrigibility/M < incorrigible --- > incorrigibleness -28593d34290 +28593d34291 < incorruptibly -28650a34348 +28650a34349 > indices -28812d34509 +28812d34510 < inflexion/SM -28981,28982c34678 +28981,28982c34679 < insert's < insert/AGSD --- > insert/AGSDM -29204a34901 +29204a34902 > intermediacy/S -29206c34903,34905 +29206c34904,34906 < intermediate/SMY --- > intermediate/SMYPGD > intermediation/SE > intermediator/SM -29216a34916 +29216a34917 > intern/GDL -29266a34967 +29266a34968 > interruptible/U -29272a34974,34977 +29272a34975,34978 > intersex > intersexual/MS > intersexualism > intersexuality -29724c35429 +29724c35430 < jewellery's --- > jewellery/M -29733,29734c35438 +29733,29734c35439 < jig's < jig/AS --- > jig/ASM -29736,29737c35440 +29736,29737c35441 < jigger's < jigger/ASDG --- > jigger/ASDGM -29799,29800c35502 +29799,29800c35503 < join's < join/AFDSG --- > join/AFDSGM -29803,29804c35505 +29803,29804c35506 < joint's < joint/EGSD --- > joint/EGSDM -29869,29870c35570,35571 +29869,29870c35571,35572 < judge's < judge/ADSG --- > judge/ADSGM > judgement/MS -30035a35737,35738 +30035a35738,35739 > keylogger/MS > keylogging/MS -30066c35769 +30066c35770 < kiddie/M --- > kiddie/SM -30102,30103c35805 +30102,30103c35806 < kind's < kind/UPRYT --- > kind/UPRYTM -30262,30263c35964 +30262,30263c35965 < kraut's < kraut/S! --- > kraut/MS! -30283,30284c35984 +30283,30284c35985 < label's < label/ASDG --- > label/ASDGM -30302,30303c36002 +30302,30303c36003 < lace's < lace/UGDS --- > lace/UGDSM -30497,30498c36196 +30497,30498c36197 < latch's < latch/UDSG --- > latch/UDSGM -30637c36335 +30637c36336 < learning's --- > learning/M -30643,30644c36341 +30643,30644c36342 < leash's < leash/UDSG --- > leash/UDSGM -30665a36363 +30665a36364 > lector/MS -30700c36398 +30700c36399 < legation's/AC --- > legation/ACM -30927,30928c36625 +30927,30928c36626 < light's/C < light/CASTGD --- > light/CASTGDM -30938c36635 +30938c36636 < lighting's --- > lighting/M -30981,30982c36678 +30981,30982c36679 < limit's < limit/CSZGDR --- > limit/CSZGDRM -30986c36682 +30986c36683 < limiter's --- > limiter/M -30990a36687,36689 +30990a36688,36690 > limnological > limnologist/MS > limnology/M -31031c36730 +31031c36731 < linguini's --- > linguini/M -31034c36733 +31034c36734 < linguistically --- > linguistical/Y -31047,31048c36746 +31047,31048c36747 < lint's < lint/CDSG --- > lint/CDSGM -31058a36757 +31058a36758 > lepidopterist/SM -31151,31152c36850 +31151,31152c36851 < liver's < liver/S --- > liver/MS -31170,31171c36868 +31170,31171c36869 < load's < load/AUGSD --- > load/AUGSDM -31211,31212c36908 +31211,31212c36909 < location's/A < location/ESM --- > location/ESMA -31291,31292c36987 +31291,31292c36988 < long's < long/KDSTG --- > long/KDSTGM -31379,31380c37074 +31379,31380c37075 < louse's < louse/CDSG --- > louse/CDSGM -31639a37334 +31639a37335 > mage/SM -31741,31742c37436 +31741,31742c37437 < make's/A < make/UAGS --- > make/UAGSM -31806a37501 +31806a37502 > malware/MS -31822,31823c37517 +31822,31823c37518 < man's/F < man/USY --- > man/USYMF -31924,31925c37618 +31924,31925c37619 < mantle's < mantle/EGDS --- > mantle/EGDSM -31940,31941c37633 +31940,31941c37634 < map's < map/AS --- > map/ASM -32061,32062c37753 +32061,32062c37754 < mask's < mask/UDSG --- > mask/UDSGM -32084,32085c37775 +32084,32085c37776 < master's < master/ADGS --- > master/ADGSM -32230c37920 +32230c37921 < meanie/M --- > meanie/MS -32246,32247c37936 +32246,32247c37937 < measure's < measure/ADSG --- > measure/ADSGM -32317,32318c38006 +32317,32318c38007 < megadeath/M < megadeaths --- > megadeath/SM -32320c38008 +32320c38009 < megajoules --- > megajoule/SM -32329c38017 +32329c38018 < megapixel/S --- > megapixel/MS -32361,32362c38049 +32361,32362c38050 < melt's < melt/ADSG --- > melt/ADSGM -32365,32366c38052 +32365,32366c38053 < member's < member/EAS --- > member/EASM -32708a38395 +32708a38396 > might've -32717a38405 +32717a38406 > migrator/SM -32760a38449 +32760a38450 > millennia -32777d38465 +32777d38466 < millionnaire/M -32806,32807c38494 +32806,32807c38495 < mind's < mind/ADRSZG --- > mind/ADRSZGM -32934a38622 +32934a38623 > miscommunication/S -32991a38680 +32991a38681 > misjudgement/MS -33027,33028c38716 +33027,33028c38717 < miss's < miss/EDSGV --- > miss/EDSGVM -33051,33052c38739 +33051,33052c38740 < mist's < mist/CDRSZG --- > mist/CDRSZGM -33056c38743 +33056c38744 < mister's --- > mister/M -33107,33108c38794 +33107,33108c38795 < mob's < mob/CS --- > mob/CSM -33448,33449c39134 +33448,33449c39135 < mortgage's < mortgage/AGDS --- > mortgage/AGDSM -33471,33472c39156 +33471,33472c39157 < mote's < mote/KCXSVN --- > mote/KCXSVNM -33539,33540c39223 +33539,33540c39224 < mounting's < mountings --- > mounting/MS -33784a39468 +33784a39469 > must've -33887,33888c39571 +33887,33888c39572 < name's < name/AGDS --- > name/AGDSM -33963c39646 +33963c39647 < native/MS --- > native/MSY -33970,33971c39653 +33970,33971c39654 < natural's < natural/UPY --- > natural/UPYM -33979,33980c39661 +33979,33980c39662 < nature's < nature/CS --- > nature/CSM -34133,34134c39814 +34133,34134c39815 < nerve's < nerve/UDSG --- > nerve/UDSGM -34169,34171c39849,39851 +34169,34171c39850,39852 < neurone/S < neurophysiology < neuroscience @@ -10488,871 +10489,871 @@ > neurophysiology/M > neuroscience/MS > neuroscientist/MS -34175a39856 +34175a39857 > neurosurgical -34275c39956 +34275c39957 < nightie/M --- > nightie/SM -34388,34389c40069 +34388,34389c40070 < nomination's/A < nomination/CSM --- > nomination/CSMA -34755,34756c40435 +34755,34756c40436 < note's < note/FCSDG --- > note/FCSDGM -34840,34841c40519 +34840,34841c40520 < number's < number/ASDG --- > number/ASDGM -35104a40783 +35104a40784 > octopi -35137,35138c40816 +35137,35138c40817 < offensive's < offensive/IYP --- > offensive/IYPM -35219d40896 +35219d40897 < oleomargarin/M -35226a40904 +35226a40905 > oligo -35345c41023 +35345c41024 < oppose/DSG --- > oppose/DSGRB -35452,35453c41130 +35452,35453c41131 < orient's < orient/AEDGS --- > orient/AEDGSM -35913c41590 +35913c41591 < oversize/D --- > oversize -36031,36032c41708 +36031,36032c41709 < pack's < pack/UADSG --- > pack/UADSGM -36034,36035c41710 +36034,36035c41711 < package's < package/AGDS --- > package/AGDSM -36041c41716 +36041c41717 < packing's --- > packing/M -36056,36059d41730 +36056,36059d41731 < paederast/S < paediatrician's < paediatricians < paediatrics/M -36291a41963 +36291a41964 > paralyses -36377a42050 +36377a42051 > parkour -36403d42075 +36403d42076 < parrakeet/MS -36418,36419c42090 +36418,36419c42091 < part's < part/CDSG --- > part/CDSGM -36445,36447c42116 +36445,36447c42117 < partition's < partition/ADG < partitions --- > partition/ADGMS -36449d42117 +36449d42118 < partizan/SM -36621,36622c42289 +36621,36622c42290 < pay's < pay/ASGBL --- > pay/ASGBLM -37093a42761 +37093a42762 > petabyte/MS -37102c42770 +37102c42771 < petitioner/M --- > petitioner/MS -37221a42890,42891 +37221a42891,42892 > phlebotomist/SM > phlebotomize/SGD -37264a42935 +37264a42936 > phosphorylate/DSGN -37310,37311c42981 +37310,37311c42982 < phrase's < phrase/AGDS --- > phrase/AGDSM -37316d42985 +37316d42986 < phrenetic -37469,37470c43138 +37469,37470c43139 < pine's < pine/AGDS --- > pine/AGDSM -37596,37597c43264 +37596,37597c43265 < place's < place/EAGLDS --- > place/EAGLDSM -37630a43298 +37630a43299 > plaintext -37636,37637c43304 +37636,37637c43305 < plane's < plane/CGDS --- > plane/CGDSM -37786,37787c43453 +37786,37787c43454 < ploy's < ploy/S --- > ploy/SM -37792,37793c43458 +37792,37793c43459 < plug's < plug/US --- > plug/USM -37796a43462 +37796a43463 > plugin/MS -37987c43653 +37987c43654 < polypeptide/S --- > polypeptide/MS -38106,38107c43772 +38106,38107c43773 < port's < port/CAEGDS --- > port/CAEGDSM -38134,38135c43799 +38134,38135c43800 < pose's/A < pose/CAKEGDS --- > pose/CAKEGDSM -38140,38141c43804 +38140,38141c43805 < position's/KC < position/ACKES --- > position/ACKESM -38260,38261c43923 +38260,38261c43924 < pound's < pound/KDSG --- > pound/KDSGM -38291d43952 +38291d43953 < practise's -38451a44113 +38451a44114 > prejudgement/MS -38568,38569c44230 +38568,38569c44231 < press's < press/ACGSD --- > press/ACGSDM -38638,38639c44299 +38638,38639c44300 < price's < price/AGDS --- > price/AGDSM -38756,38757c44416 +38756,38757c44417 < process's < process/AGDS --- > process/AGDSM -38780,38781c44439 +38780,38781c44440 < produce's < produce/AZGDRS --- > produce/AZGDRSM -38805a44464 +38805a44465 > profiler/SM -38835a44495 +38835a44496 > programmatically -38891a44552,44553 +38891a44553,44554 > pronate/DSGN > pronator/MS -38951c44613 +38951c44614 < proprietorship/M --- > proprietorship/MS -39039a44702 +39039a44703 > provender/M -39095a44759 +39095a44760 > pseudorandom/Y -39564a45229 +39564a45230 > quinoa -39581,39582c45246 +39581,39582c45247 < quire's < quire/IAS --- > quire/IASM -39614,39615c45278 +39614,39615c45279 < quote's < quote/UDSG --- > quote/UDSGM -39653,39654c45316 +39653,39654c45317 < racoon's < racoons --- > racoon/MS -39738,39739c45400 +39738,39739c45401 < rail's < rail/CGDS --- > rail/CGDSM -39816,39817c45477 +39816,39817c45478 < range's < range/CGDS --- > range/CGDSM -39873a45534,45535 +39873a45535,45536 > rasterization/M > rasterize/SGDR -39925,39926c45587 +39925,39926c45588 < ravel's < ravel/UDSG --- > ravel/UDSGM -40036a45698 +40036a45699 > recency -40140a45803 +40140a45804 > recurse/DGSV -40141a45805 +40141a45806 > recuse/DGS -40204,40205c45868 +40204,40205c45869 < reel's < reel/UGDS --- > reel/UGDSM -40208a45872 +40208a45873 > refactor/SMDG -40244d45907 +40244d45908 < reflexion/SM -40659d46321 +40659d46322 < resizing -40829c46491 +40829c46492 < reverie/M --- > reverie/MS -40895a46558,46560 +40895a46559,46561 > rheumatological > rheumatology/M > rheumatologist/SM -40944,40945c46609 +40944,40945c46610 < ride's < ride/CZGS --- > ride/CZGSM -41104,41105c46768 +41104,41105c46769 < robe's < robe/EGDS --- > robe/EGDSM -41132,41133c46795 +41132,41133c46796 < rogue's < rogue/KS --- > rogue/KSM -41185a46848 +41185a46849 > rootkit/MS -41258,41259c46921 +41258,41259c46922 < route's < route/ADSG --- > route/ADSGM -41415a47078 +41415a47079 > sabre/MS -41447,41448c47110 +41447,41448c47111 < saddle's < saddle/UDSG --- > saddle/UDSGM -41463,41464c47125 +41463,41464c47126 < safe's < safe/UYTPR --- > safe/UYTPRM -41544,41545c47205 +41544,41545c47206 < salt's < salt/CTGDS --- > salt/CTGDSM -41765,41766c47425 +41765,41766c47426 < say's < say/USG --- > say/USGM -41787,41788c47446 +41787,41788c47447 < scale's < scale/ACSDG --- > scale/ACSDGM -41806,41807c47464 +41806,41807c47465 < scan's < scan/AS --- > scan/ASM -41880,41881c47537 +41880,41881c47538 < schedule's < schedule/ADSG --- > schedule/ADSGM -41914c47570 +41914c47571 < schnaps's --- > schnaps/M -41949c47605 +41949c47606 < schrod's --- > schrod/SM -41998a47655 +41998a47656 > scot-free -42016,42017c47673 +42016,42017c47674 < scramble's < scramble/UGDS --- > scramble/UGDSM -42055,42056c47711 +42055,42056c47712 < screw's < screw/UDSG --- > screw/UDSGM -42065,42066c47720 +42065,42066c47721 < scribe's < scribe/IKCGSD --- > scribe/IKCGSDM -42170,42171c47824 +42170,42171c47825 < seal's < seal/AUSDG --- > seal/AUSDGM -42204,42205c47857 +42204,42205c47858 < seat's < seat/UGDS --- > seat/UGDSM -42288,42289c47940 +42288,42289c47941 < seed's < seed/AGDS --- > seed/AGDSM -42365,42367c48016,48017 +42365,42367c48017,48018 < sell's < sell/AZGRS < seller's --- > sell/AZGRSM > seller/M -42524c48174 +42524c48175 < seraphim's --- > seraphim/M -42558,42559c48208 +42558,42559c48209 < serve's/AF < serve/FACGDS --- > serve/FACGDSM -42574,42575c48223 +42574,42575c48224 < serving's < servings --- > serving/MS -42594,42595c48242 +42594,42595c48243 < settle's < settle/AUGDS --- > settle/AUGDSM -42647,42648c48294 +42647,42648c48295 < shackle's < shackle/UGDS --- > shackle/UGDSM -42716,42717c48362 +42716,42717c48363 < shape's < shape/AGDS --- > shape/AGDSM -42851,42852c48496 +42851,42852c48497 < ship's < ship/ALS --- > ship/ALSM -42883,42885c48527 +42883,42885c48528 < shit's < shit/S! < shite/S! --- > shit/MS! -42887,42888c48529,48530 +42887,42888c48530,48531 < shithead/S! < shitload/! --- > shithead/MS! > shitload/MS! -42891c48533 +42891c48534 < shitty/RT! --- > shitty/TR! -42976a48619 +42976a48620 > should've -43008c48651 +43008c48652 < showtime --- > showtime/MS -43090,43091c48733 +43090,43091c48734 < side's < side/AGDS --- > side/AGDSM -43143,43144c48785 +43143,43144c48786 < sign's < sign/AFCGDS --- > sign/AFCGDSM -43163,43164c48804 +43163,43164c48805 < signing's/C < signings --- > signing/MCS -43328c48968 +43328c48969 < size/MGBDRS --- > size/AMGBDRS -43368,43369c49008 +43368,43369c49009 < skill's < skill/CSD --- > skill/CSDM -43724,43726c49363 +43724,43726c49364 < smoulder's < smouldered < smoulders --- > smoulder/GSMD -43752,43753c49389 +43752,43753c49390 < snap's < snap/US --- > snap/USM -43767,43768c49403,49405 +43767,43768c49404,49406 < snarl's < snarl/USDG --- > snarkily > snarky/TR > snarl/USDGM -44012,44013c49649 +44012,44013c49650 < solute's < solute/XN --- > solute/XNM -44015c49651 +44015c49652 < solution's/EA --- > solution/EAM -44021c49657 +44021c49658 < solver's --- > solver/M -44041a49678 +44041a49679 > sommelier/SM -44062c49699 +44062c49700 < sonofabitch --- > sonofabitch/! -44177,44178c49814 +44177,44178c49815 < sow's < sow/ASGD --- > sow/ASGDM -44346a49983 +44346a49984 > spelled -44348a49986 +44348a49987 > spelt -44371a50010 +44371a50011 > spick/S! -44383c50022 +44383c50023 < spik/S --- > spik/S! -44413,44414c50052 +44413,44414c50053 < spire's < spire/IFAS --- > spire/IFASM -44416,44417c50054 +44416,44417c50055 < spirit's < spirit/ISGD --- > spirit/ISGDM -44475,44476c50112 +44475,44476c50113 < spoil's < spoil/CSDRZG --- > spoil/CSDRZGM -44549,44550c50185 +44549,44550c50186 < spray's < spray/ASDG --- > spray/ASDGM -44688,44689c50323 +44688,44689c50324 < staff's < staff/ASDG --- > staff/ASDGM -44729,44730c50363 +44729,44730c50364 < stall's < stall/SDG --- > stall/SDGM -44985,44986c50618 +44985,44986c50619 < still's < still/ITGSD --- > still/ITGSDM -45024,45025c50656 +45024,45025c50657 < stitch's < stitch/ADSG --- > stitch/ADSGM -45030,45031c50661 +45030,45031c50662 < stock's < stock/AGSD --- > stock/AGSDM -45090,45091c50720 +45090,45091c50721 < stop's < stop/US --- > stop/USM -45105,45106c50734 +45105,45106c50735 < store's < store/ADSG --- > store/ADSGM -45148,45149c50776 +45148,45149c50777 < strain's < strain/FADSG --- > strain/FADSGM -45164,45165c50791 +45164,45165c50792 < strap's < strap/US --- > strap/USM -45290,45291c50916 +45290,45291c50917 < structure's < structure/AGDS --- > structure/AGDSM -45330,45331c50955 +45330,45331c50956 < study's < study/AGDS --- > study/AGDSM -45368,45369c50992 +45368,45369c50993 < style's < style/ADSG --- > style/ADSGM -45455,45456c51078 +45455,45456c51079 < submission's < submission/AS --- > submission/ASM -45872,45873c51494 +45872,45873c51495 < surface's < surface/AGDS --- > surface/AGDSM -45918,45919c51539 +45918,45919c51540 < survey's < survey/ADGS --- > survey/ADGSM -46106a51727 +46106a51728 > syllabi -46160c51781 +46160c51782 < synch/GMD --- > synch/GMDS -46167d51787 +46167d51788 < synchs -46178a51799,51801 +46178a51800,51802 > synesthesia > synesthete/S > synesthetic -46203,46204c51826,51827 +46203,46204c51827,51828 < sysadmin/S < sysop/S --- > sysadmin/MS > sysop/MS -46363,46364c51986 +46363,46364c51987 < tangle's < tangle/UDSG --- > tangle/UDSGM -46632a52255,52256 +46632a52256,52257 > teleport/SGD > teleportation -46675,46676c52299 +46675,46676c52300 < template's < template/S --- > template/SM -46752a52376 +46752a52377 > terabit/MS -46753a52378,52379 +46753a52379,52380 > terahertz/M > terapixel/MS -46806,46807c52432 +46806,46807c52433 < test's/AFK < test/AKFCDGS --- > test/AKFCDGSM -46817a52443 +46817a52444 > testcase/MS -46831a52458 +46831a52459 > testsuite/MS -46845a52473 +46845a52474 > textbox/SM -46925a52554 +46925a52555 > theremin/MS -46999c52628 +46999c52629 < thinking's --- > thinking/M -47095,47096c52724 +47095,47096c52725 < throne's < throne/CDS --- > throne/CDSM -47188,47189c52816 +47188,47189c52817 < tie's < tie/AUSD --- > tie/AUSDM -47213,47214c52840 +47213,47214c52841 < till's < till/EDRZGS --- > till/EDRZGSM -47303,47304c52929 +47303,47304c52930 < tire's < tire/AGDS --- > tire/AGDSM -47433,47434c53058 +47433,47434c53059 < tone's < tone/IZGDRS --- > tone/IZGDRSM -47453,47455c53077,53078 +47453,47455c53078,53079 < tool's < tool/ADGS < toolbar --- > tool/ADGSM > toolbar/MS -47540,47541c53163 +47540,47541c53164 < tort's < tort/FEAS --- > tort/FEASM -47644a53267 +47644a53268 > traceur/SM -47657,47658c53280 +47657,47658c53281 < tract's < tract/CEKFAS --- > tract/CEKFASM -47755a53378 +47755a53379 > transfect/DSMG -47774a53398,53399 +47774a53399,53400 > transgenderism > transgene/MS -47807,47808c53432 +47807,47808c53433 < transmission's < transmission/AS --- > transmission/ASM -47928,47929c53552 +47928,47929c53553 < trench's < trench/AIGSD --- > trench/AIGSDM -47951c53574 +47951c53575 < triage/M --- > triage/MGS -47976,47977c53599 +47976,47977c53600 < tribute's < tribute/FS --- > tribute/FSM -47997a53620 +47997a53621 > trifecta/S -48165,48166c53788 +48165,48166c53789 < trust's/E < trust/IESGD --- > trust/IESGDM -48180,48181c53802 +48180,48181c53803 < try's < try/AGDS --- > try/AGDSM -48371,48372c53992 +48371,48372c53993 < twist's < twist/USDG --- > twist/USDGM -48396,48397c54016 +48396,48397c54017 < type's < type/AGDS --- > type/AGDSM -48869a54489 +48869a54490 > unlikeable -49163,49164c54783 +49163,49164c54784 < usual's < usual/UY --- > usual/UYM -49211c54830 +49211c54831 < vagina/M --- > vagina/MS -49249,49250c54868 +49249,49250c54869 < value's < value/CAGSD --- > value/CAGSDM -49292,49293c54910 +49292,49293c54911 < variant's < variant/IS --- > variant/ISM -49356,49357c54973 +49356,49357c54974 < veil's < veil/UDGS --- > veil/UDGSM -49368,49369c54984 +49368,49369c54985 < velour's < velours's --- > velour/MS -49398,49399c55013 +49398,49399c55014 < vent's < vent/DGS --- > vent/DGSM -49435,49436c55049 +49435,49436c55050 < verge's < verge/FDSG --- > verge/FDSGM -49478a55092 +49478a55093 > vertices -49488,49489c55102 +49488,49489c55103 < vest's < vest/ILDGS --- > vest/ILDGSM -49681,49682c55294 +49681,49682c55295 < visit's < visit/ASGD --- > visit/ASGDM -49772a55385,55387 +49772a55386,55388 > volcanological > volcanologist/MS > volcanology/M -49807,49808c55422 +49807,49808c55423 < vote's < vote/CGVDS --- > vote/CGVDSM -50148a55763 +50148a55764 > weaponize/DSG -50215,50216c55830 +50215,50216c55831 < weigh's < weigh/AGD --- > weigh/AGDM -50260,50261d55873 +50260,50261d55874 < werwolf/M < werwolves -50555,50556c56167 +50555,50556c56168 < wind's < wind/UASG --- > wind/UASGM -50626,50627c56237 +50626,50627c56238 < wire's < wire/AGDS --- > wire/AGDSM -50728c56338 +50728c56339 < women --- > women/M -50794,50796c56404,56405 +50794,50796c56405,56406 < wop/S! < word's < word/AJDSG --- > wop/MS! > word/AJDSGM -50801c56410 +50801c56411 < wording's --- > wording/M -50808,50809c56417 +50808,50809c56418 < work's < work/ADJSG --- > work/ADJSGM -50824c56432 +50824c56433 < working's --- > working/M -50884,50885c56492 +50884,50885c56493 < worthy's < worthy/UPRT --- > worthy/UPRTM -50903,50904c56510 +50903,50904c56511 < wrap's < wrap/US --- > wrap/USM -50945c56551 +50945c56552 < writing's --- > writing/M -51118,51119c56724 +51118,51119c56725 < yoke's < yoke/UGDS --- > yoke/UGDSM -51212,51213c56817 +51212,51213c56818 < zip's < zip/US --- > zip/USM -51228,51229c56832 +51228,51229c56833 < zone's < zone/AGDS --- diff --git a/extensions/spellcheck/locales/en-US/hunspell/en-US.dic b/extensions/spellcheck/locales/en-US/hunspell/en-US.dic index 01bb76cef72..0198ad1d1b8 100644 --- a/extensions/spellcheck/locales/en-US/hunspell/en-US.dic +++ b/extensions/spellcheck/locales/en-US/hunspell/en-US.dic @@ -1,4 +1,4 @@ -57219 +57220 0/nm 0th/pt 1/n1 @@ -10811,6 +10811,7 @@ Mozart/M Mozelle/M Mozes/M Mozilla/M +Mozillian/SM Mr/SM Ms/S Msgr From ab361e10f1959c59f010ffdcde326849d2c7e040 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 11 Jun 2014 21:10:00 -0400 Subject: [PATCH 06/68] Bug 966166 - Part 1: Parse @counter-style rule. r=dbaron, r=bz --- dom/base/nsDOMClassInfo.cpp | 8 + dom/base/nsDOMClassInfoClasses.h | 3 + dom/interfaces/css/moz.build | 1 + .../css/nsIDOMCSSCounterStyleRule.idl | 23 + dom/interfaces/css/nsIDOMCSSRule.idl | 1 + .../en-US/chrome/layout/css.properties | 8 + .../mochitest/general/test_interfaces.html | 2 + layout/style/Rule.h | 3 +- layout/style/moz.build | 1 + layout/style/nsCSSCounterDescList.h | 15 + layout/style/nsCSSKeywordList.h | 9 + layout/style/nsCSSParser.cpp | 429 +++++++++++++++++ layout/style/nsCSSParser.h | 11 + layout/style/nsCSSProperty.h | 10 + layout/style/nsCSSProps.cpp | 102 ++++ layout/style/nsCSSProps.h | 12 + layout/style/nsCSSRuleProcessor.cpp | 36 ++ layout/style/nsCSSRuleProcessor.h | 4 + layout/style/nsCSSRules.cpp | 454 ++++++++++++++++++ layout/style/nsCSSRules.h | 71 +++ layout/style/nsCSSStyleSheet.cpp | 1 + layout/style/nsStyleConsts.h | 16 + layout/style/nsStyleSet.cpp | 21 + layout/style/nsStyleSet.h | 5 + 24 files changed, 1245 insertions(+), 1 deletion(-) create mode 100644 dom/interfaces/css/nsIDOMCSSCounterStyleRule.idl create mode 100644 layout/style/nsCSSCounterDescList.h diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index dcd7e502e07..985a648ec08 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -98,6 +98,7 @@ #include "nsIDOMCSSSupportsRule.h" #include "nsIDOMMozCSSKeyframeRule.h" #include "nsIDOMMozCSSKeyframesRule.h" +#include "nsIDOMCSSCounterStyleRule.h" #include "nsIDOMCSSPageRule.h" #include "nsIDOMCSSStyleRule.h" #include "nsIDOMXULCommandDispatcher.h" @@ -411,6 +412,9 @@ static nsDOMClassInfoData sClassInfoData[] = { NS_DEFINE_CLASSINFO_DATA(MozCSSKeyframesRule, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(CSSCounterStyleRule, nsDOMGenericSH, + DOM_DEFAULT_SCRIPTABLE_FLAGS) + NS_DEFINE_CLASSINFO_DATA(CSSPageRule, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) @@ -1036,6 +1040,10 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozCSSKeyframesRule) DOM_CLASSINFO_MAP_END + DOM_CLASSINFO_MAP_BEGIN(CSSCounterStyleRule, nsIDOMCSSCounterStyleRule) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSCounterStyleRule) + DOM_CLASSINFO_MAP_END + DOM_CLASSINFO_MAP_BEGIN(CSSPageRule, nsIDOMCSSPageRule) DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSPageRule) DOM_CLASSINFO_MAP_END diff --git a/dom/base/nsDOMClassInfoClasses.h b/dom/base/nsDOMClassInfoClasses.h index edcf9ec62d4..d06c51f3ad7 100644 --- a/dom/base/nsDOMClassInfoClasses.h +++ b/dom/base/nsDOMClassInfoClasses.h @@ -76,6 +76,9 @@ DOMCI_CLASS(ChromeMessageSender) DOMCI_CLASS(MozCSSKeyframeRule) DOMCI_CLASS(MozCSSKeyframesRule) +// @counter-style in CSS +DOMCI_CLASS(CSSCounterStyleRule) + DOMCI_CLASS(CSSPageRule) DOMCI_CLASS(CSSFontFeatureValuesRule) diff --git a/dom/interfaces/css/moz.build b/dom/interfaces/css/moz.build index f523d87ba68..3846cebc56c 100644 --- a/dom/interfaces/css/moz.build +++ b/dom/interfaces/css/moz.build @@ -8,6 +8,7 @@ XPIDL_SOURCES += [ 'nsIDOMCounter.idl', 'nsIDOMCSSCharsetRule.idl', 'nsIDOMCSSConditionRule.idl', + 'nsIDOMCSSCounterStyleRule.idl', 'nsIDOMCSSFontFaceRule.idl', 'nsIDOMCSSFontFeatureValuesRule.idl', 'nsIDOMCSSGroupingRule.idl', diff --git a/dom/interfaces/css/nsIDOMCSSCounterStyleRule.idl b/dom/interfaces/css/nsIDOMCSSCounterStyleRule.idl new file mode 100644 index 00000000000..f9fc494e79e --- /dev/null +++ b/dom/interfaces/css/nsIDOMCSSCounterStyleRule.idl @@ -0,0 +1,23 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMCSSRule.idl" + +[scriptable, uuid(5f9f2068-743b-42e3-becb-10ffa994d1e3)] +interface nsIDOMCSSCounterStyleRule : nsIDOMCSSRule +{ + attribute DOMString name; + attribute DOMString system; + attribute DOMString symbols; + attribute DOMString additiveSymbols; + attribute DOMString negative; + attribute DOMString prefix; + attribute DOMString suffix; + attribute DOMString range; + attribute DOMString pad; + attribute DOMString speakAs; + attribute DOMString fallback; +}; diff --git a/dom/interfaces/css/nsIDOMCSSRule.idl b/dom/interfaces/css/nsIDOMCSSRule.idl index 94c81fc73c4..cbd273fbd12 100644 --- a/dom/interfaces/css/nsIDOMCSSRule.idl +++ b/dom/interfaces/css/nsIDOMCSSRule.idl @@ -31,6 +31,7 @@ interface nsIDOMCSSRule : nsISupports const unsigned short MOZ_KEYFRAMES_RULE = 7; const unsigned short MOZ_KEYFRAME_RULE = 8; const unsigned short NAMESPACE_RULE = 10; + const unsigned short COUNTER_STYLE_RULE = 11; const unsigned short SUPPORTS_RULE = 12; const unsigned short FONT_FEATURE_VALUES_RULE = 14; diff --git a/dom/locales/en-US/chrome/layout/css.properties b/dom/locales/en-US/chrome/layout/css.properties index e6a59a56536..582df671f9b 100644 --- a/dom/locales/en-US/chrome/layout/css.properties +++ b/dom/locales/en-US/chrome/layout/css.properties @@ -44,6 +44,14 @@ PESelectorListExtraEOF=',' or '{' PESelectorListExtra=Expected ',' or '{' but found '%1$S'. PESelectorGroupNoSelector=Selector expected. PESelectorGroupExtraCombinator=Dangling combinator. +PECounterStyleNotIdent=Expected identifier for name of @counter-style rule. +PECounterStyleBadName=Name of @counter-style rule can't be '%1$S'. +PECounterStyleBadBlockStart=Expected '{' to begin @counter-style rule but found '%1$S'. +PECounterStyleEOF=closing '}' of @counter-style block +PECounterDescExpected=Expected counter descriptor but found '%1$S'. +PEUnknownCounterDesc=Unknown descriptor '%1$S' in @counter-style rule. +PECounterExtendsNotIdent=Expected identifier for extends system but found '%1$S'. +PECounterASWeight=Each weight in the additive-symbols descriptor must be smaller than the previous weight. PEClassSelEOF=class name PEClassSelNotIdent=Expected identifier for class selector but found '%1$S'. PETypeSelEOF=element type diff --git a/dom/tests/mochitest/general/test_interfaces.html b/dom/tests/mochitest/general/test_interfaces.html index e4ce7e6d69f..cbd921b77f5 100644 --- a/dom/tests/mochitest/general/test_interfaces.html +++ b/dom/tests/mochitest/general/test_interfaces.html @@ -224,6 +224,8 @@ var interfaceNamesInGlobalScope = "CSSCharsetRule", // IMPORTANT: Do not change this list without review from a DOM peer! "CSSConditionRule", +// IMPORTANT: Do not change this list without review from a DOM peer! + "CSSCounterStyleRule", // IMPORTANT: Do not change this list without review from a DOM peer! "CSSFontFaceRule", // IMPORTANT: Do not change this list without review from a DOM peer! diff --git a/layout/style/Rule.h b/layout/style/Rule.h index f88c91fb12d..3d1d5b1be1d 100644 --- a/layout/style/Rule.h +++ b/layout/style/Rule.h @@ -67,7 +67,8 @@ public: KEYFRAMES_RULE, DOCUMENT_RULE, SUPPORTS_RULE, - FONT_FEATURE_VALUES_RULE + FONT_FEATURE_VALUES_RULE, + COUNTER_STYLE_RULE }; virtual int32_t GetType() const = 0; diff --git a/layout/style/moz.build b/layout/style/moz.build index 9518c60d1e2..447c4750433 100644 --- a/layout/style/moz.build +++ b/layout/style/moz.build @@ -13,6 +13,7 @@ EXPORTS += [ 'nsComputedDOMStylePropertyList.h', 'nsCSSAnonBoxes.h', 'nsCSSAnonBoxList.h', + 'nsCSSCounterDescList.h', 'nsCSSFontDescList.h', 'nsCSSKeywordList.h', 'nsCSSKeywords.h', diff --git a/layout/style/nsCSSCounterDescList.h b/layout/style/nsCSSCounterDescList.h new file mode 100644 index 00000000000..03431b46903 --- /dev/null +++ b/layout/style/nsCSSCounterDescList.h @@ -0,0 +1,15 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +CSS_COUNTER_DESC(system, System) +CSS_COUNTER_DESC(symbols, Symbols) +CSS_COUNTER_DESC(additive-symbols, AdditiveSymbols) +CSS_COUNTER_DESC(negative, Negative) +CSS_COUNTER_DESC(prefix, Prefix) +CSS_COUNTER_DESC(suffix, Suffix) +CSS_COUNTER_DESC(range, Range) +CSS_COUNTER_DESC(pad, Pad) +CSS_COUNTER_DESC(fallback, Fallback) +CSS_COUNTER_DESC(speak-as, SpeakAs) diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h index 5e705d7b709..a40f9c13640 100644 --- a/layout/style/nsCSSKeywordList.h +++ b/layout/style/nsCSSKeywordList.h @@ -156,6 +156,7 @@ CSS_KEY(absolute, absolute) CSS_KEY(active, active) CSS_KEY(activeborder, activeborder) CSS_KEY(activecaption, activecaption) +CSS_KEY(additive, additive) CSS_KEY(alias, alias) CSS_KEY(all, all) CSS_KEY(all-petite-caps, all_petite_caps) @@ -192,6 +193,7 @@ CSS_KEY(bottom-outside, bottom_outside) CSS_KEY(break-all, break_all) CSS_KEY(break-word, break_word) CSS_KEY(brightness, brightness) +CSS_KEY(bullets, bullets) CSS_KEY(button, button) CSS_KEY(buttonface, buttonface) CSS_KEY(buttonhighlight, buttonhighlight) @@ -240,6 +242,7 @@ CSS_KEY(cross, cross) CSS_KEY(crosshair, crosshair) CSS_KEY(currentcolor, currentcolor) CSS_KEY(cursive, cursive) +CSS_KEY(cyclic, cyclic) CSS_KEY(darken, darken) CSS_KEY(dashed, dashed) CSS_KEY(dense, dense) @@ -274,6 +277,7 @@ CSS_KEY(end, end) CSS_KEY(ex, ex) CSS_KEY(exclusion, exclusion) CSS_KEY(expanded, expanded) +CSS_KEY(extends, extends) CSS_KEY(extra-condensed, extra_condensed) CSS_KEY(extra-expanded, extra_expanded) CSS_KEY(ew-resize, ew_resize) @@ -410,6 +414,7 @@ CSS_KEY(none, none) CSS_KEY(normal, normal) CSS_KEY(not-allowed, not_allowed) CSS_KEY(nowrap, nowrap) +CSS_KEY(numeric, numeric) CSS_KEY(ns-resize, ns_resize) CSS_KEY(nw-resize, nw_resize) CSS_KEY(nwse-resize, nwse_resize) @@ -511,6 +516,7 @@ CSS_KEY(solid, solid) CSS_KEY(space-around, space_around) CSS_KEY(space-between, space_between) CSS_KEY(span, span) +CSS_KEY(spell-out, spell_out) CSS_KEY(square, square) CSS_KEY(stack, stack) CSS_KEY(stacked-fractions, stacked_fractions) @@ -594,6 +600,7 @@ CSS_KEY(wider, wider) CSS_KEY(window, window) CSS_KEY(windowframe, windowframe) CSS_KEY(windowtext, windowtext) +CSS_KEY(words, words) CSS_KEY(wrap, wrap) CSS_KEY(wrap-reverse, wrap_reverse) CSS_KEY(write-only, write_only) @@ -626,6 +633,7 @@ CSS_KEY(resizerpanel, resizerpanel) CSS_KEY(resizer, resizer) CSS_KEY(listbox, listbox) CSS_KEY(listitem, listitem) +CSS_KEY(numbers, numbers) CSS_KEY(number-input, number_input) CSS_KEY(treeview, treeview) CSS_KEY(treeitem, treeitem) @@ -742,6 +750,7 @@ CSS_KEY(reset-size, reset_size) //CSS_KEY(square, square) //CSS_KEY(start, start) CSS_KEY(srgb, srgb) +CSS_KEY(symbolic, symbolic) CSS_KEY(text-after-edge, text_after_edge) CSS_KEY(text-before-edge, text_before_edge) CSS_KEY(use-script, use_script) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 883500edeec..fe4f5ac57c7 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -197,6 +197,18 @@ public: nsIURI* aBaseURL, nsIPrincipal* aDocPrincipal); + bool ParseCounterStyleName(const nsAString& aBuffer, + nsIURI* aURL, + nsAString& aName); + + bool ParseCounterDescriptor(nsCSSCounterDesc aDescID, + const nsAString& aBuffer, + nsIURI* aSheetURL, + nsIURI* aBaseURL, + nsIPrincipal* aSheetPrincipal, + nsCSSValue& aValue); + + typedef nsCSSParser::VariableEnumFunc VariableEnumFunc; /** @@ -470,6 +482,13 @@ protected: bool& aConditionMet, SupportsConditionTermOperator aOperator); + bool ParseCounterStyleRule(RuleAppendFunc aAppendFunc, void* aProcessData); + bool ParseCounterStyleName(nsAString& aName, bool aForDefinition); + bool ParseCounterDescriptor(nsCSSCounterStyleRule *aRule); + bool ParseCounterDescriptorValue(nsCSSCounterDesc aDescID, + nsCSSValue& aValue); + bool ParseCounterRange(nsCSSValuePair& aPair); + /** * Parses the current input stream for a CSS token stream value and resolves * any variable references using the variables in aVariables. @@ -856,6 +875,10 @@ protected: bool ParseOneOrLargerVariant(nsCSSValue& aValue, int32_t aVariantMask, const KTableValue aKeywordTable[]); + bool ParseNonNegativeInteger(nsCSSValue& aValue) + { + return ParseNonNegativeVariant(aValue, VARIANT_INTEGER, nullptr); + } // http://dev.w3.org/csswg/css-values/#custom-idents // Parse an identifier that is none of: @@ -2368,6 +2391,44 @@ CSSParserImpl::ParsePropertyWithVariableReferences( mTempData.AssertInitialState(); } +bool +CSSParserImpl::ParseCounterStyleName(const nsAString& aBuffer, + nsIURI* aURL, + nsAString& aName) +{ + nsCSSScanner scanner(aBuffer, 0); + css::ErrorReporter reporter(scanner, mSheet, mChildLoader, aURL); + InitScanner(scanner, reporter, aURL, aURL, nullptr); + + bool success = ParseCounterStyleName(aName, true) && !GetToken(true); + + OUTPUT_ERROR(); + ReleaseScanner(); + + return success; +} + +bool +CSSParserImpl::ParseCounterDescriptor(nsCSSCounterDesc aDescID, + const nsAString& aBuffer, + nsIURI* aSheetURL, + nsIURI* aBaseURL, + nsIPrincipal* aSheetPrincipal, + nsCSSValue& aValue) +{ + nsCSSScanner scanner(aBuffer, 0); + css::ErrorReporter reporter(scanner, mSheet, mChildLoader, aSheetURL); + InitScanner(scanner, reporter, aSheetURL, aBaseURL, aSheetPrincipal); + + bool success = ParseCounterDescriptorValue(aDescID, aValue) && + !GetToken(true); + + OUTPUT_ERROR(); + ReleaseScanner(); + + return success; +} + //---------------------------------------------------------------------- bool @@ -2594,6 +2655,10 @@ CSSParserImpl::ParseAtRule(RuleAppendFunc aAppendFunc, parseFunc = &CSSParserImpl::ParseSupportsRule; newSection = eCSSSection_General; + } else if (mToken.mIdent.LowerCaseEqualsLiteral("counter-style")) { + parseFunc = &CSSParserImpl::ParseCounterStyleRule; + newSection = eCSSSection_General; + } else { if (!NonMozillaVendorIdentifier(mToken.mIdent)) { REPORT_UNEXPECTED_TOKEN(PEUnknownAtRule); @@ -3959,6 +4024,348 @@ CSSParserImpl::ParseSupportsConditionTermsAfterOperator( } } +bool +CSSParserImpl::ParseCounterStyleRule(RuleAppendFunc aAppendFunc, void* aData) +{ + nsAutoString name; + if (!ParseCounterStyleName(name, true)) { + REPORT_UNEXPECTED_TOKEN(PECounterStyleNotIdent); + return false; + } + + if (!ExpectSymbol('{', true)) { + REPORT_UNEXPECTED_TOKEN(PECounterStyleBadBlockStart); + return false; + } + + nsRefPtr rule = new nsCSSCounterStyleRule(name); + for (;;) { + if (!GetToken(true)) { + REPORT_UNEXPECTED_EOF(PECounterStyleEOF); + break; + } + if (mToken.IsSymbol('}')) { + break; + } + if (mToken.IsSymbol(';')) { + continue; + } + + if (!ParseCounterDescriptor(rule)) { + REPORT_UNEXPECTED(PEDeclSkipped); + OUTPUT_ERROR(); + if (!SkipDeclaration(true)) { + REPORT_UNEXPECTED_EOF(PECounterStyleEOF); + break; + } + } + } + + int32_t system = rule->GetSystem(); + bool isCorrect = false; + switch (system) { + case NS_STYLE_COUNTER_SYSTEM_CYCLIC: + case NS_STYLE_COUNTER_SYSTEM_NUMERIC: + case NS_STYLE_COUNTER_SYSTEM_ALPHABETIC: + case NS_STYLE_COUNTER_SYSTEM_SYMBOLIC: + case NS_STYLE_COUNTER_SYSTEM_FIXED: { + // check whether symbols is set and the length is sufficient + const nsCSSValue& symbols = rule->GetDesc(eCSSCounterDesc_Symbols); + if (symbols.GetUnit() == eCSSUnit_List && + nsCSSCounterStyleRule::CheckDescValue( + system, eCSSCounterDesc_Symbols, symbols)) { + isCorrect = true; + } + break; + } + case NS_STYLE_COUNTER_SYSTEM_ADDITIVE: { + // for additive system, additive-symbols must be set + const nsCSSValue& symbols = + rule->GetDesc(eCSSCounterDesc_AdditiveSymbols); + if (symbols.GetUnit() == eCSSUnit_PairList) { + isCorrect = true; + } + break; + } + case NS_STYLE_COUNTER_SYSTEM_EXTENDS: { + // for extends system, symbols & additive-symbols must not be set + const nsCSSValue& symbols = rule->GetDesc(eCSSCounterDesc_Symbols); + const nsCSSValue& additiveSymbols = + rule->GetDesc(eCSSCounterDesc_AdditiveSymbols); + if (symbols.GetUnit() == eCSSUnit_Null && + additiveSymbols.GetUnit() == eCSSUnit_Null) { + isCorrect = true; + } + break; + } + default: + NS_NOTREACHED("unknown system"); + } + + if (isCorrect) { + (*aAppendFunc)(rule, aData); + } + return true; +} + +bool +CSSParserImpl::ParseCounterStyleName(nsAString& aName, bool aForDefinition) +{ + if (!GetToken(true)) { + return false; + } + + if (mToken.mType != eCSSToken_Ident) { + UngetToken(); + return false; + } + + static const nsCSSKeyword kReservedNames[] = { + eCSSKeyword_none, + eCSSKeyword_decimal, + eCSSKeyword_UNKNOWN + }; + + nsCSSValue value; // we don't actually care about the value + if (!ParseCustomIdent(value, mToken.mIdent, + aForDefinition ? kReservedNames : nullptr)) { + REPORT_UNEXPECTED_TOKEN(PECounterStyleBadName); + UngetToken(); + return false; + } + + aName = mToken.mIdent; + if (nsCSSProps::IsPredefinedCounterStyle(aName)) { + ToLowerCase(aName); + } + return true; +} + +bool +CSSParserImpl::ParseCounterDescriptor(nsCSSCounterStyleRule* aRule) +{ + if (eCSSToken_Ident != mToken.mType) { + REPORT_UNEXPECTED_TOKEN(PECounterDescExpected); + return false; + } + + nsString descName = mToken.mIdent; + if (!ExpectSymbol(':', true)) { + REPORT_UNEXPECTED_TOKEN(PEParseDeclarationNoColon); + OUTPUT_ERROR(); + return false; + } + + nsCSSCounterDesc descID = nsCSSProps::LookupCounterDesc(descName); + nsCSSValue value; + + if (descID == eCSSCounterDesc_UNKNOWN) { + REPORT_UNEXPECTED_P(PEUnknownCounterDesc, descName); + return false; + } + + if (!ParseCounterDescriptorValue(descID, value)) { + REPORT_UNEXPECTED_P(PEValueParsingError, descName); + return false; + } + + if (!ExpectEndProperty()) { + return false; + } + + aRule->SetDesc(descID, value); + return true; +} + +bool +CSSParserImpl::ParseCounterDescriptorValue(nsCSSCounterDesc aDescID, + nsCSSValue& aValue) +{ + // Should also include VARIANT_IMAGE, but it is not supported currently. + // See bug 1024179. + static const int32_t VARIANT_COUNTER_SYMBOL = + VARIANT_STRING | VARIANT_IDENTIFIER; + + switch (aDescID) { + case eCSSCounterDesc_System: { + nsCSSValue system; + if (!ParseEnum(system, nsCSSProps::kCounterSystemKTable)) { + return false; + } + switch (system.GetIntValue()) { + case NS_STYLE_COUNTER_SYSTEM_FIXED: { + nsCSSValue start; + if (!ParseVariant(start, VARIANT_INTEGER, nullptr)) { + start.SetIntValue(1, eCSSUnit_Integer); + } + aValue.SetPairValue(system, start); + return true; + } + case NS_STYLE_COUNTER_SYSTEM_EXTENDS: { + nsString name; + if (!ParseCounterStyleName(name, false)) { + REPORT_UNEXPECTED_TOKEN(PECounterExtendsNotIdent); + return false; + } + aValue.SetPairValue(system, nsCSSValue(name, eCSSUnit_Ident)); + return true; + } + default: + aValue = system; + return true; + } + } + + case eCSSCounterDesc_Negative: { + nsCSSValue first, second; + if (!ParseVariant(first, VARIANT_COUNTER_SYMBOL, nullptr)) { + return false; + } + if (!ParseVariant(second, VARIANT_COUNTER_SYMBOL, nullptr)) { + aValue = first; + } else { + aValue.SetPairValue(first, second); + } + return true; + } + + case eCSSCounterDesc_Prefix: + case eCSSCounterDesc_Suffix: + return ParseVariant(aValue, VARIANT_COUNTER_SYMBOL, nullptr); + + case eCSSCounterDesc_Range: { + if (ParseVariant(aValue, VARIANT_AUTO, nullptr)) { + return true; + } + nsCSSValuePairList* item = aValue.SetPairListValue(); + for (;;) { + nsCSSValuePair pair; + if (!ParseCounterRange(pair)) { + return false; + } + item->mXValue = pair.mXValue; + item->mYValue = pair.mYValue; + if (!ExpectSymbol(',', true)) { + return true; + } + item->mNext = new nsCSSValuePairList; + item = item->mNext; + } + // should always return in the loop + } + + case eCSSCounterDesc_Pad: { + nsCSSValue width, symbol; + bool hasWidth = ParseNonNegativeInteger(width); + if (!ParseVariant(symbol, VARIANT_COUNTER_SYMBOL, nullptr) || + (!hasWidth && !ParseNonNegativeInteger(width))) { + return false; + } + aValue.SetPairValue(width, symbol); + return true; + } + + case eCSSCounterDesc_Fallback: { + nsString name; + if (!ParseCounterStyleName(name, false)) { + return false; + } + aValue.SetStringValue(name, eCSSUnit_Ident); + return true; + } + + case eCSSCounterDesc_Symbols: { + nsCSSValueList* item = nullptr; + for (;;) { + nsCSSValue value; + if (!ParseVariant(value, VARIANT_COUNTER_SYMBOL, nullptr)) { + return !!item; + } + if (!item) { + item = aValue.SetListValue(); + } else { + item->mNext = new nsCSSValueList; + item = item->mNext; + } + item->mValue = value; + } + // should always return in the loop + } + + case eCSSCounterDesc_AdditiveSymbols: { + nsCSSValuePairList* item = nullptr; + int32_t lastWeight = -1; + for (;;) { + nsCSSValue weight, symbol; + bool hasWeight = ParseNonNegativeInteger(weight); + if (!ParseVariant(symbol, VARIANT_COUNTER_SYMBOL, nullptr) || + (!hasWeight && !ParseNonNegativeInteger(weight))) { + return false; + } + if (lastWeight != -1 && weight.GetIntValue() >= lastWeight) { + REPORT_UNEXPECTED(PECounterASWeight); + return false; + } + lastWeight = weight.GetIntValue(); + if (!item) { + item = aValue.SetPairListValue(); + } else { + item->mNext = new nsCSSValuePairList; + item = item->mNext; + } + item->mXValue = weight; + item->mYValue = symbol; + if (!ExpectSymbol(',', true)) { + return true; + } + } + // should always return in the loop + } + + case eCSSCounterDesc_SpeakAs: { + if (ParseVariant(aValue, VARIANT_AUTO | VARIANT_KEYWORD, + nsCSSProps::kCounterSpeakAsKTable)) { + if (aValue.GetUnit() == eCSSUnit_Enumerated && + aValue.GetIntValue() == NS_STYLE_COUNTER_SPEAKAS_SPELL_OUT) { + // Currently spell-out is not supported, so it is explicitly + // rejected here rather than parsed as a custom identifier. + // See bug 1024178. + return false; + } + return true; + } + nsString name; + if (ParseCounterStyleName(name, false)) { + aValue.SetStringValue(name, eCSSUnit_Ident); + return true; + } + return false; + } + + default: + NS_NOTREACHED("unknown descriptor"); + return false; + } +} + +bool +CSSParserImpl::ParseCounterRange(nsCSSValuePair& aPair) +{ + static const int32_t VARIANT_BOUND = VARIANT_INTEGER | VARIANT_KEYWORD; + nsCSSValue lower, upper; + if (!ParseVariant(lower, VARIANT_BOUND, nsCSSProps::kCounterRangeKTable) || + !ParseVariant(upper, VARIANT_BOUND, nsCSSProps::kCounterRangeKTable)) { + return false; + } + if (lower.GetUnit() != eCSSUnit_Enumerated && + upper.GetUnit() != eCSSUnit_Enumerated && + lower.GetIntValue() > upper.GetIntValue()) { + return false; + } + aPair = nsCSSValuePair(lower, upper); + return true; +} + bool CSSParserImpl::SkipUntil(char16_t aStopSymbol) { @@ -14359,3 +14766,25 @@ nsCSSParser::ParsePropertyWithVariableReferences( aBaseURL, aDocPrincipal, aSheet, aLineNumber, aLineOffset); } + +bool +nsCSSParser::ParseCounterStyleName(const nsAString& aBuffer, + nsIURI* aURL, + nsAString& aName) +{ + return static_cast(mImpl)-> + ParseCounterStyleName(aBuffer, aURL, aName); +} + +bool +nsCSSParser::ParseCounterDescriptor(nsCSSCounterDesc aDescID, + const nsAString& aBuffer, + nsIURI* aSheetURL, + nsIURI* aBaseURL, + nsIPrincipal* aSheetPrincipal, + nsCSSValue& aValue) +{ + return static_cast(mImpl)-> + ParseCounterDescriptor(aDescID, aBuffer, + aSheetURL, aBaseURL, aSheetPrincipal, aValue); +} diff --git a/layout/style/nsCSSParser.h b/layout/style/nsCSSParser.h index 66241fa288d..6cec4099d13 100644 --- a/layout/style/nsCSSParser.h +++ b/layout/style/nsCSSParser.h @@ -264,6 +264,17 @@ public: uint32_t aLineNumber, uint32_t aLineOffset); + bool ParseCounterStyleName(const nsAString& aBuffer, + nsIURI* aURL, + nsAString& aName); + + bool ParseCounterDescriptor(nsCSSCounterDesc aDescID, + const nsAString& aBuffer, + nsIURI* aSheetURL, + nsIURI* aBaseURL, + nsIPrincipal* aSheetPrincipal, + nsCSSValue& aValue); + protected: // This is a CSSParserImpl*, but if we expose that type name in this // header, we can't put the type definition (in nsCSSParser.cpp) in diff --git a/layout/style/nsCSSProperty.h b/layout/style/nsCSSProperty.h index 7ced1161de0..b29ffdd4acc 100644 --- a/layout/style/nsCSSProperty.h +++ b/layout/style/nsCSSProperty.h @@ -72,4 +72,14 @@ enum nsCSSFontDesc { eCSSFontDesc_COUNT }; +// The "descriptors" that can appear in a @counter-style rule. +// They have the syntax of properties but different value rules. +enum nsCSSCounterDesc { + eCSSCounterDesc_UNKNOWN = -1, +#define CSS_COUNTER_DESC(name_, method_) eCSSCounterDesc_##method_, +#include "nsCSSCounterDescList.h" +#undef CSS_COUNTER_DESC + eCSSCounterDesc_COUNT +}; + #endif /* nsCSSProperty_h___ */ diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 110d6c2d8bf..9e4d1023b93 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -51,6 +51,8 @@ using namespace mozilla; static int32_t gPropertyTableRefCount; static nsStaticCaseInsensitiveNameTable* gPropertyTable; static nsStaticCaseInsensitiveNameTable* gFontDescTable; +static nsStaticCaseInsensitiveNameTable* gCounterDescTable; +static nsStaticCaseInsensitiveNameTable* gPredefinedCounterStyleTable; /* static */ nsCSSProperty * nsCSSProps::gShorthandsContainingTable[eCSSProperty_COUNT_no_shorthands]; @@ -62,6 +64,25 @@ static const char* const kCSSRawFontDescs[] = { #undef CSS_FONT_DESC }; +static const char* const kCSSRawCounterDescs[] = { +#define CSS_COUNTER_DESC(name_, method_) #name_, +#include "nsCSSCounterDescList.h" +#undef CSS_COUNTER_DESC +}; + +static const char* const kCSSRawPredefinedCounterStyles[] = { + "none", "decimal", "decimal-leading-zero", "cjk-decimal", + "lower-roman", "upper-roman", "armenian", "georgian", "hebrew", + "lower-alpha", "lower-latin", "upper-alpha", "upper-latin", + "lower-greek", "hiragana", "hiragana-iroha", "katakana", "katakana-iroha", + "disc", "circle", "square", "disclosure-open", "disclosure-closed", + "japanese-informal", "japanese-formal", + "korean-hangul-formal", "korean-hanja-informal", "korean-hanja-formal", + "simp-chinese-informal", "simp-chinese-formal", + "trad-chinese-informal", "trad-chinese-formal", "cjk-ideographic", + "ethiopic-numeric" +}; + struct PropertyAndCount { nsCSSProperty property; uint32_t count; @@ -121,10 +142,17 @@ nsCSSProps::AddRefTable(void) if (0 == gPropertyTableRefCount++) { NS_ABORT_IF_FALSE(!gPropertyTable, "pre existing array!"); NS_ABORT_IF_FALSE(!gFontDescTable, "pre existing array!"); + NS_ABORT_IF_FALSE(!gCounterDescTable, "pre existing array!"); + NS_ABORT_IF_FALSE(!gPredefinedCounterStyleTable, "pre existing array!"); gPropertyTable = CreateStaticTable( kCSSRawProperties, eCSSProperty_COUNT_with_aliases); gFontDescTable = CreateStaticTable(kCSSRawFontDescs, eCSSFontDesc_COUNT); + gCounterDescTable = CreateStaticTable( + kCSSRawCounterDescs, eCSSCounterDesc_COUNT); + gPredefinedCounterStyleTable = CreateStaticTable( + kCSSRawPredefinedCounterStyles, + ArrayLength(kCSSRawPredefinedCounterStyles)); BuildShorthandsContainingTable(); @@ -333,6 +361,12 @@ nsCSSProps::ReleaseTable(void) delete gFontDescTable; gFontDescTable = nullptr; + delete gCounterDescTable; + gCounterDescTable = nullptr; + + delete gPredefinedCounterStyleTable; + gPredefinedCounterStyleTable = nullptr; + delete [] gShorthandsContainingPool; gShorthandsContainingPool = nullptr; } @@ -456,6 +490,38 @@ nsCSSProps::LookupFontDesc(const nsAString& aFontDesc) return which; } +nsCSSCounterDesc +nsCSSProps::LookupCounterDesc(const nsAString& aProperty) +{ + NS_ABORT_IF_FALSE(gCounterDescTable, "no lookup table, needs addref"); + return nsCSSCounterDesc(gCounterDescTable->Lookup(aProperty)); +} + +nsCSSCounterDesc +nsCSSProps::LookupCounterDesc(const nsACString& aProperty) +{ + NS_ABORT_IF_FALSE(gCounterDescTable, "no lookup table, needs addref"); + return nsCSSCounterDesc(gCounterDescTable->Lookup(aProperty)); +} + +bool +nsCSSProps::IsPredefinedCounterStyle(const nsAString& aStyle) +{ + NS_ABORT_IF_FALSE(gPredefinedCounterStyleTable, + "no lookup table, needs addref"); + return gPredefinedCounterStyleTable->Lookup(aStyle) != + nsStaticCaseInsensitiveNameTable::NOT_FOUND; +} + +bool +nsCSSProps::IsPredefinedCounterStyle(const nsACString& aStyle) +{ + NS_ABORT_IF_FALSE(gPredefinedCounterStyleTable, + "no lookup table, needs addref"); + return gPredefinedCounterStyleTable->Lookup(aStyle) != + nsStaticCaseInsensitiveNameTable::NOT_FOUND; +} + const nsAFlatCString& nsCSSProps::GetStringValue(nsCSSProperty aProperty) { @@ -480,6 +546,18 @@ nsCSSProps::GetStringValue(nsCSSFontDesc aFontDescID) } } +const nsAFlatCString& +nsCSSProps::GetStringValue(nsCSSCounterDesc aCounterDesc) +{ + NS_ABORT_IF_FALSE(gCounterDescTable, "no lookup table, needs addref"); + if (gCounterDescTable) { + return gCounterDescTable->GetStringValue(int32_t(aCounterDesc)); + } else { + static nsDependentCString sNullStr(""); + return sNullStr; + } +} + nsCSSProperty nsCSSProps::OtherNameFor(nsCSSProperty aProperty) { @@ -1910,6 +1988,30 @@ const KTableValue nsCSSProps::kColumnFillKTable[] = { eCSSKeyword_UNKNOWN, -1 }; +const KTableValue nsCSSProps::kCounterSystemKTable[] = { + eCSSKeyword_cyclic, NS_STYLE_COUNTER_SYSTEM_CYCLIC, + eCSSKeyword_numeric, NS_STYLE_COUNTER_SYSTEM_NUMERIC, + eCSSKeyword_alphabetic, NS_STYLE_COUNTER_SYSTEM_ALPHABETIC, + eCSSKeyword_symbolic, NS_STYLE_COUNTER_SYSTEM_SYMBOLIC, + eCSSKeyword_additive, NS_STYLE_COUNTER_SYSTEM_ADDITIVE, + eCSSKeyword_fixed, NS_STYLE_COUNTER_SYSTEM_FIXED, + eCSSKeyword_extends, NS_STYLE_COUNTER_SYSTEM_EXTENDS, + eCSSKeyword_UNKNOWN, -1 +}; + +const KTableValue nsCSSProps::kCounterRangeKTable[] = { + eCSSKeyword_infinite, NS_STYLE_COUNTER_RANGE_INFINITE, + eCSSKeyword_UNKNOWN, -1 +}; + +const KTableValue nsCSSProps::kCounterSpeakAsKTable[] = { + eCSSKeyword_bullets, NS_STYLE_COUNTER_SPEAKAS_BULLETS, + eCSSKeyword_numbers, NS_STYLE_COUNTER_SPEAKAS_NUMBERS, + eCSSKeyword_words, NS_STYLE_COUNTER_SPEAKAS_WORDS, + eCSSKeyword_spell_out, NS_STYLE_COUNTER_SPEAKAS_SPELL_OUT, + eCSSKeyword_UNKNOWN, -1 +}; + static bool IsKeyValSentinel(nsCSSKeyword aKey, KTableValue aValue) { return aKey == eCSSKeyword_UNKNOWN && aValue == -1; diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index 0a6a4e5ec44..7b4d0401f35 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -310,9 +310,18 @@ public: static nsCSSFontDesc LookupFontDesc(const nsAString& aProperty); static nsCSSFontDesc LookupFontDesc(const nsACString& aProperty); + // For @counter-style descriptors + static nsCSSCounterDesc LookupCounterDesc(const nsAString& aProperty); + static nsCSSCounterDesc LookupCounterDesc(const nsACString& aProperty); + + // For predefined counter styles which need to be lower-cased during parse + static bool IsPredefinedCounterStyle(const nsAString& aStyle); + static bool IsPredefinedCounterStyle(const nsACString& aStyle); + // Given a property enum, get the string value static const nsAFlatCString& GetStringValue(nsCSSProperty aProperty); static const nsAFlatCString& GetStringValue(nsCSSFontDesc aFontDesc); + static const nsAFlatCString& GetStringValue(nsCSSCounterDesc aCounterDesc); // Get the property to report the computed value of aProperty as being // the computed value of. aProperty must have the @@ -641,6 +650,9 @@ public: static const KTableValue kWordWrapKTable[]; static const KTableValue kWritingModeKTable[]; static const KTableValue kHyphensKTable[]; + static const KTableValue kCounterSystemKTable[]; + static const KTableValue kCounterRangeKTable[]; + static const KTableValue kCounterSpeakAsKTable[]; }; inline nsCSSProps::EnabledState operator|(nsCSSProps::EnabledState a, diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index 022326bab91..59087be8eec 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -928,6 +928,7 @@ struct RuleCascadeData { mStateSelectors(), mSelectorDocumentStates(0), mKeyframesRuleTable(16), + mCounterStyleRuleTable(16), mCacheKey(aMedium), mNext(nullptr), mQuirksMode(aQuirksMode) @@ -988,8 +989,10 @@ struct RuleCascadeData { nsTArray mKeyframesRules; nsTArray mFontFeatureValuesRules; nsTArray mPageRules; + nsTArray mCounterStyleRules; nsDataHashtable mKeyframesRuleTable; + nsDataHashtable mCounterStyleRuleTable; // Looks up or creates the appropriate list in |mAttributeSelectors|. // Returns null only on allocation failure. @@ -1058,6 +1061,7 @@ RuleCascadeData::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const n += mKeyframesRules.SizeOfExcludingThis(aMallocSizeOf); n += mFontFeatureValuesRules.SizeOfExcludingThis(aMallocSizeOf); n += mPageRules.SizeOfExcludingThis(aMallocSizeOf); + n += mCounterStyleRules.SizeOfExcludingThis(aMallocSizeOf); n += mKeyframesRuleTable.SizeOfExcludingThis(SizeOfKeyframesRuleEntryExcludingThis, aMallocSizeOf, nullptr); @@ -2884,6 +2888,19 @@ nsCSSRuleProcessor::KeyframesRuleForName(nsPresContext* aPresContext, return nullptr; } +nsCSSCounterStyleRule* +nsCSSRuleProcessor::CounterStyleRuleForName(nsPresContext* aPresContext, + const nsAString& aName) +{ + RuleCascadeData* cascade = GetRuleCascade(aPresContext); + + if (cascade) { + return cascade->mCounterStyleRuleTable.Get(aName); + } + + return nullptr; +} + // Append all the currently-active page rules to aArray. Return // true for success and false for failure. bool @@ -3224,6 +3241,7 @@ struct CascadeEnumData { nsTArray& aKeyframesRules, nsTArray& aFontFeatureValuesRules, nsTArray& aPageRules, + nsTArray& aCounterStyleRules, nsMediaQueryResultCacheKey& aKey, uint8_t aSheetType) : mPresContext(aPresContext), @@ -3231,6 +3249,7 @@ struct CascadeEnumData { mKeyframesRules(aKeyframesRules), mFontFeatureValuesRules(aFontFeatureValuesRules), mPageRules(aPageRules), + mCounterStyleRules(aCounterStyleRules), mCacheKey(aKey), mSheetType(aSheetType) { @@ -3255,6 +3274,7 @@ struct CascadeEnumData { nsTArray& mKeyframesRules; nsTArray& mFontFeatureValuesRules; nsTArray& mPageRules; + nsTArray& mCounterStyleRules; nsMediaQueryResultCacheKey& mCacheKey; PLArenaPool mArena; // Hooray, a manual PLDHashTable since nsClassHashtable doesn't @@ -3274,6 +3294,7 @@ struct CascadeEnumData { * (4) add any @font-feature-value rules, in order, * into data->mFontFeatureValuesRules. * (5) add any @page rules, in order, into data->mPageRules. + * (6) add any @counter-style rules, in order, into data->mCounterStyleRules. */ static bool CascadeRuleEnumFunc(css::Rule* aRule, void* aData) @@ -3339,6 +3360,13 @@ CascadeRuleEnumFunc(css::Rule* aRule, void* aData) return false; } } + else if (css::Rule::COUNTER_STYLE_RULE == type) { + nsCSSCounterStyleRule* counterStyleRule = + static_cast(aRule); + if (!data->mCounterStyleRules.AppendElement(counterStyleRule)) { + return false; + } + } return true; } @@ -3443,6 +3471,7 @@ nsCSSRuleProcessor::RefreshRuleCascade(nsPresContext* aPresContext) newCascade->mKeyframesRules, newCascade->mFontFeatureValuesRules, newCascade->mPageRules, + newCascade->mCounterStyleRules, newCascade->mCacheKey, mSheetType); if (!data.mRulesByWeight.ops) @@ -3481,6 +3510,13 @@ nsCSSRuleProcessor::RefreshRuleCascade(nsPresContext* aPresContext) newCascade->mKeyframesRuleTable.Put(rule->GetName(), rule); } + // Build mCounterStyleRuleTable + for (nsTArray::size_type i = 0, + iEnd = newCascade->mCounterStyleRules.Length(); i < iEnd; ++i) { + nsCSSCounterStyleRule* rule = newCascade->mCounterStyleRules[i]; + newCascade->mCounterStyleRuleTable.Put(rule->GetName(), rule); + } + // Ensure that the current one is always mRuleCascades. newCascade->mNext = mRuleCascades; mRuleCascades = newCascade.forget(); diff --git a/layout/style/nsCSSRuleProcessor.h b/layout/style/nsCSSRuleProcessor.h index ac989ca83b2..00146c3fc2f 100644 --- a/layout/style/nsCSSRuleProcessor.h +++ b/layout/style/nsCSSRuleProcessor.h @@ -29,6 +29,7 @@ class nsCSSKeyframesRule; class nsCSSPageRule; class nsCSSFontFeatureValuesRule; class nsCSSStyleSheet; +class nsCSSCounterStyleRule; /** * The CSS style rule processor provides a mechanism for sibling style @@ -129,6 +130,9 @@ public: nsCSSKeyframesRule* KeyframesRuleForName(nsPresContext* aPresContext, const nsString& aName); + nsCSSCounterStyleRule* CounterStyleRuleForName(nsPresContext* aPresContext, + const nsAString& aName); + bool AppendPageRules(nsPresContext* aPresContext, nsTArray& aArray); diff --git a/layout/style/nsCSSRules.cpp b/layout/style/nsCSSRules.cpp index de505ff8628..d4ca8e19c2c 100644 --- a/layout/style/nsCSSRules.cpp +++ b/layout/style/nsCSSRules.cpp @@ -3042,3 +3042,457 @@ CSSSupportsRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const // Must be outside namespace DOMCI_DATA(CSSSupportsRule, mozilla::CSSSupportsRule) + +// ------------------------------------------- +// nsCSSCounterStyleRule +// + +nsCSSCounterStyleRule::nsCSSCounterStyleRule(const nsCSSCounterStyleRule& aCopy) + : Rule(aCopy), + mName(aCopy.mName) +{ +} + +nsCSSCounterStyleRule::~nsCSSCounterStyleRule() +{ +} + +/* virtual */ already_AddRefed +nsCSSCounterStyleRule::Clone() const +{ + nsRefPtr clone = new nsCSSCounterStyleRule(*this); + return clone.forget(); +} + +nsCSSCounterStyleRule::Getter const +nsCSSCounterStyleRule::kGetters[] = { +#define CSS_COUNTER_DESC(name_, method_) &nsCSSCounterStyleRule::Get##method_, +#include "nsCSSCounterDescList.h" +#undef CSS_COUNTER_DESC +}; + +NS_IMPL_ADDREF(nsCSSCounterStyleRule) +NS_IMPL_RELEASE(nsCSSCounterStyleRule) + +DOMCI_DATA(CSSCounterStyleRule, nsCSSCounterStyleRule) + +// QueryInterface implementation for nsCSSCounterStyleRule +NS_INTERFACE_MAP_BEGIN(nsCSSCounterStyleRule) + NS_INTERFACE_MAP_ENTRY(nsIStyleRule) + NS_INTERFACE_MAP_ENTRY(nsIDOMCSSRule) + NS_INTERFACE_MAP_ENTRY(nsIDOMCSSCounterStyleRule) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIStyleRule) + NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSCounterStyleRule) +NS_INTERFACE_MAP_END + +IMPL_STYLE_RULE_INHERIT(nsCSSCounterStyleRule, css::Rule) + +#ifdef DEBUG +void +nsCSSCounterStyleRule::List(FILE* out, int32_t aIndent) const +{ + nsCString baseInd, descInd; + for (int32_t indent = aIndent; --indent >= 0; ) { + baseInd.AppendLiteral(" "); + } + descInd = baseInd; + descInd.AppendLiteral(" "); + + fprintf(out, "%s@counter-style %s (rev.%u) {\n", + baseInd.get(), NS_ConvertUTF16toUTF8(mName).get(), mGeneration); + // TODO + fprintf(out, "%s}\n", baseInd.get()); +} +#endif + +/* virtual */ int32_t +nsCSSCounterStyleRule::GetType() const +{ + return Rule::COUNTER_STYLE_RULE; +} + +// nsIDOMCSSRule methods +NS_IMETHODIMP +nsCSSCounterStyleRule::GetType(uint16_t* aType) +{ + *aType = nsIDOMCSSRule::COUNTER_STYLE_RULE; + return NS_OK; +} + +NS_IMETHODIMP +nsCSSCounterStyleRule::GetCssText(nsAString& aCssText) +{ + aCssText.AssignLiteral(MOZ_UTF16("@counter-style ")); + nsStyleUtil::AppendEscapedCSSIdent(mName, aCssText); + aCssText.AppendLiteral(MOZ_UTF16(" {\n")); + for (nsCSSCounterDesc id = nsCSSCounterDesc(0); + id < eCSSCounterDesc_COUNT; + id = nsCSSCounterDesc(id + 1)) { + if (mValues[id].GetUnit() != eCSSUnit_Null) { + nsAutoString tmp; + (this->*kGetters[id])(tmp); + aCssText.AppendLiteral(MOZ_UTF16(" ")); + AppendASCIItoUTF16(nsCSSProps::GetStringValue(id), aCssText); + aCssText.AppendLiteral(MOZ_UTF16(": ")); + aCssText.Append(tmp); + aCssText.AppendLiteral(MOZ_UTF16(";\n")); + } + } + aCssText.AppendLiteral(MOZ_UTF16("}")); + return NS_OK; +} + +NS_IMETHODIMP +nsCSSCounterStyleRule::SetCssText(const nsAString& aCssText) +{ + // FIXME: implement??? + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsCSSCounterStyleRule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet) +{ + return Rule::GetParentStyleSheet(aSheet); +} + +NS_IMETHODIMP +nsCSSCounterStyleRule::GetParentRule(nsIDOMCSSRule** aParentRule) +{ + return Rule::GetParentRule(aParentRule); +} + +// nsIDOMCSSCounterStyleRule methods +NS_IMETHODIMP +nsCSSCounterStyleRule::GetName(nsAString& aName) +{ + aName.Truncate(); + nsStyleUtil::AppendEscapedCSSIdent(mName, aName); + return NS_OK; +} + +NS_IMETHODIMP +nsCSSCounterStyleRule::SetName(const nsAString& aName) +{ + nsCSSParser parser; + nsAutoString name; + if (parser.ParseCounterStyleName(aName, nullptr, name)) { + nsIDocument* doc = GetDocument(); + MOZ_AUTO_DOC_UPDATE(doc, UPDATE_STYLE, true); + + mName = name; + + nsCSSStyleSheet* sheet = GetStyleSheet(); + if (sheet) { + sheet->SetModifiedByChildRule(); + if (doc) { + doc->StyleRuleChanged(sheet, this, this); + } + } + } + return NS_OK; +} + +int32_t +nsCSSCounterStyleRule::GetSystem() const +{ + const nsCSSValue& system = GetDesc(eCSSCounterDesc_System); + switch (system.GetUnit()) { + case eCSSUnit_Enumerated: + return system.GetIntValue(); + case eCSSUnit_Pair: + return system.GetPairValue().mXValue.GetIntValue(); + default: + return NS_STYLE_COUNTER_SYSTEM_SYMBOLIC; + } +} + +const nsCSSValue& +nsCSSCounterStyleRule::GetSystemArgument() const +{ + const nsCSSValue& system = GetDesc(eCSSCounterDesc_System); + NS_ABORT_IF_FALSE(system.GetUnit() == eCSSUnit_Pair, + "Invalid system value"); + return system.GetPairValue().mYValue; +} + +void +nsCSSCounterStyleRule::SetDesc(nsCSSCounterDesc aDescID, const nsCSSValue& aValue) +{ + NS_ABORT_IF_FALSE(aDescID >= 0 && aDescID < eCSSCounterDesc_COUNT, + "descriptor ID out of range"); + + nsIDocument* doc = GetDocument(); + MOZ_AUTO_DOC_UPDATE(doc, UPDATE_STYLE, true); + + mValues[aDescID] = aValue; + mGeneration++; + + nsCSSStyleSheet* sheet = GetStyleSheet(); + if (sheet) { + sheet->SetModifiedByChildRule(); + if (doc) { + doc->StyleRuleChanged(sheet, this, this); + } + } +} + +NS_IMETHODIMP +nsCSSCounterStyleRule::GetSystem(nsAString& aSystem) +{ + const nsCSSValue& value = GetDesc(eCSSCounterDesc_System); + if (value.GetUnit() == eCSSUnit_Null) { + aSystem.Truncate(); + return NS_OK; + } + + aSystem = NS_ConvertASCIItoUTF16(nsCSSProps::ValueToKeyword( + GetSystem(), nsCSSProps::kCounterSystemKTable)); + if (value.GetUnit() == eCSSUnit_Pair) { + aSystem.Append(' '); + GetSystemArgument().AppendToString( + eCSSProperty_UNKNOWN, aSystem, nsCSSValue::eNormalized); + } + return NS_OK; +} + +NS_IMETHODIMP +nsCSSCounterStyleRule::GetSymbols(nsAString& aSymbols) +{ + const nsCSSValue& value = GetDesc(eCSSCounterDesc_Symbols); + + aSymbols.Truncate(); + if (value.GetUnit() == eCSSUnit_List) { + for (const nsCSSValueList* item = value.GetListValue(); + item; item = item->mNext) { + item->mValue.AppendToString(eCSSProperty_UNKNOWN, + aSymbols, + nsCSSValue::eNormalized); + if (item->mNext) { + aSymbols.Append(' '); + } + } + } + return NS_OK; +} + +NS_IMETHODIMP +nsCSSCounterStyleRule::GetAdditiveSymbols(nsAString& aSymbols) +{ + const nsCSSValue& value = GetDesc(eCSSCounterDesc_AdditiveSymbols); + + aSymbols.Truncate(); + if (value.GetUnit() == eCSSUnit_PairList) { + for (const nsCSSValuePairList* item = value.GetPairListValue(); + item; item = item->mNext) { + item->mXValue.AppendToString(eCSSProperty_UNKNOWN, + aSymbols, nsCSSValue::eNormalized); + aSymbols.Append(' '); + item->mYValue.AppendToString(eCSSProperty_UNKNOWN, + aSymbols, nsCSSValue::eNormalized); + if (item->mNext) { + aSymbols.AppendLiteral(", "); + } + } + } + return NS_OK; +} + +NS_IMETHODIMP +nsCSSCounterStyleRule::GetRange(nsAString& aRange) +{ + const nsCSSValue& value = GetDesc(eCSSCounterDesc_Range); + + switch (value.GetUnit()) { + case eCSSUnit_Auto: + aRange.AssignLiteral(MOZ_UTF16("auto")); + break; + + case eCSSUnit_PairList: + aRange.Truncate(); + for (const nsCSSValuePairList* item = value.GetPairListValue(); + item; item = item->mNext) { + const nsCSSValue& lower = item->mXValue; + const nsCSSValue& upper = item->mYValue; + if (lower.GetUnit() == eCSSUnit_Enumerated) { + NS_ASSERTION(lower.GetIntValue() == + NS_STYLE_COUNTER_RANGE_INFINITE, + "Unrecognized keyword"); + aRange.AppendLiteral("infinite"); + } else { + aRange.AppendInt(lower.GetIntValue()); + } + aRange.Append(' '); + if (upper.GetUnit() == eCSSUnit_Enumerated) { + NS_ASSERTION(upper.GetIntValue() == + NS_STYLE_COUNTER_RANGE_INFINITE, + "Unrecognized keyword"); + aRange.AppendLiteral("infinite"); + } else { + aRange.AppendInt(upper.GetIntValue()); + } + if (item->mNext) { + aRange.AppendLiteral(", "); + } + } + break; + + default: + aRange.Truncate(); + } + return NS_OK; +} + +NS_IMETHODIMP +nsCSSCounterStyleRule::GetSpeakAs(nsAString& aSpeakAs) +{ + const nsCSSValue& value = GetDesc(eCSSCounterDesc_SpeakAs); + + switch (value.GetUnit()) { + case eCSSUnit_Enumerated: + switch (value.GetIntValue()) { + case NS_STYLE_COUNTER_SPEAKAS_BULLETS: + aSpeakAs.AssignLiteral(MOZ_UTF16("bullets")); + break; + case NS_STYLE_COUNTER_SPEAKAS_NUMBERS: + aSpeakAs.AssignLiteral(MOZ_UTF16("numbers")); + break; + case NS_STYLE_COUNTER_SPEAKAS_WORDS: + aSpeakAs.AssignLiteral(MOZ_UTF16("words")); + break; + case NS_STYLE_COUNTER_SPEAKAS_SPELL_OUT: + aSpeakAs.AssignLiteral(MOZ_UTF16("spell-out")); + break; + default: + NS_NOTREACHED("Unknown speech synthesis"); + } + break; + + case eCSSUnit_Auto: + case eCSSUnit_Ident: + aSpeakAs.Truncate(); + value.AppendToString(eCSSProperty_UNKNOWN, + aSpeakAs, nsCSSValue::eNormalized); + break; + + default: + aSpeakAs.Truncate(); + } + return NS_OK; +} + +nsresult +nsCSSCounterStyleRule::GetDescriptor(nsCSSCounterDesc aDescID, + nsAString& aValue) +{ + NS_ASSERTION(aDescID == eCSSCounterDesc_Negative || + aDescID == eCSSCounterDesc_Prefix || + aDescID == eCSSCounterDesc_Suffix || + aDescID == eCSSCounterDesc_Pad || + aDescID == eCSSCounterDesc_Fallback, + "Unexpected descriptor"); + const nsCSSValue& value = GetDesc(aDescID); + aValue.Truncate(); + if (value.GetUnit() != eCSSUnit_Null) { + value.AppendToString( + eCSSProperty_UNKNOWN, aValue, nsCSSValue::eNormalized); + } + return NS_OK; +} + +#define CSS_COUNTER_DESC_GETTER(name_) \ +NS_IMETHODIMP \ +nsCSSCounterStyleRule::Get##name_(nsAString& a##name_) \ +{ \ + return GetDescriptor(eCSSCounterDesc_##name_, a##name_);\ +} +CSS_COUNTER_DESC_GETTER(Negative) +CSS_COUNTER_DESC_GETTER(Prefix) +CSS_COUNTER_DESC_GETTER(Suffix) +CSS_COUNTER_DESC_GETTER(Pad) +CSS_COUNTER_DESC_GETTER(Fallback) +#undef CSS_COUNTER_DESC_GETTER + +/* static */ bool +nsCSSCounterStyleRule::CheckDescValue(int32_t aSystem, + nsCSSCounterDesc aDescID, + const nsCSSValue& aValue) +{ + switch (aDescID) { + case eCSSCounterDesc_System: + if (aValue.GetUnit() != eCSSUnit_Pair) { + return aValue.GetIntValue() == aSystem; + } else { + return aValue.GetPairValue().mXValue.GetIntValue() == aSystem; + } + + case eCSSCounterDesc_Symbols: + switch (aSystem) { + case NS_STYLE_COUNTER_SYSTEM_NUMERIC: + case NS_STYLE_COUNTER_SYSTEM_ALPHABETIC: + // for these two system, the list must contain at least 2 elements + return aValue.GetListValue()->mNext; + case NS_STYLE_COUNTER_SYSTEM_EXTENDS: + // for extends system, no symbols should be set + return false; + default: + return true; + } + + case eCSSCounterDesc_AdditiveSymbols: + switch (aSystem) { + case NS_STYLE_COUNTER_SYSTEM_EXTENDS: + return false; + default: + return true; + } + + default: + return true; + } +} + +nsresult +nsCSSCounterStyleRule::SetDescriptor(nsCSSCounterDesc aDescID, + const nsAString& aValue) +{ + nsCSSParser parser; + nsCSSValue value; + nsCSSStyleSheet* sheet = GetStyleSheet(); + nsIURI* baseURL = nullptr; + nsIPrincipal* principal = nullptr; + if (sheet) { + baseURL = sheet->GetBaseURI(); + principal = sheet->Principal(); + } + if (parser.ParseCounterDescriptor(aDescID, aValue, nullptr, + baseURL, principal, value)) { + if (CheckDescValue(GetSystem(), aDescID, value)) { + SetDesc(aDescID, value); + } + } + return NS_OK; +} + +#define CSS_COUNTER_DESC_SETTER(name_) \ +NS_IMETHODIMP \ +nsCSSCounterStyleRule::Set##name_(const nsAString& a##name_) \ +{ \ + return SetDescriptor(eCSSCounterDesc_##name_, a##name_); \ +} +CSS_COUNTER_DESC_SETTER(System) +CSS_COUNTER_DESC_SETTER(Symbols) +CSS_COUNTER_DESC_SETTER(AdditiveSymbols) +CSS_COUNTER_DESC_SETTER(Negative) +CSS_COUNTER_DESC_SETTER(Prefix) +CSS_COUNTER_DESC_SETTER(Suffix) +CSS_COUNTER_DESC_SETTER(Range) +CSS_COUNTER_DESC_SETTER(Pad) +CSS_COUNTER_DESC_SETTER(Fallback) +CSS_COUNTER_DESC_SETTER(SpeakAs) +#undef CSS_COUNTER_DESC_SETTER + +/* virtual */ size_t +nsCSSCounterStyleRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const +{ + return aMallocSizeOf(this); +} diff --git a/layout/style/nsCSSRules.h b/layout/style/nsCSSRules.h index 0d9dbc29765..9eaff61fb53 100644 --- a/layout/style/nsCSSRules.h +++ b/layout/style/nsCSSRules.h @@ -15,6 +15,7 @@ #include "mozilla/MemoryReporting.h" #include "mozilla/css/GroupRule.h" #include "nsIDOMCSSConditionRule.h" +#include "nsIDOMCSSCounterStyleRule.h" #include "nsIDOMCSSFontFaceRule.h" #include "nsIDOMCSSFontFeatureValuesRule.h" #include "nsIDOMCSSGroupingRule.h" @@ -641,4 +642,74 @@ protected: } // namespace mozilla +class nsCSSCounterStyleRule MOZ_FINAL : public mozilla::css::Rule, + public nsIDOMCSSCounterStyleRule +{ +public: + explicit nsCSSCounterStyleRule(const nsAString& aName) + : mName(aName), + mGeneration(0) + { + } + +private: + nsCSSCounterStyleRule(const nsCSSCounterStyleRule& aCopy); + ~nsCSSCounterStyleRule(); + +public: + NS_DECL_ISUPPORTS + + // nsIStyleRule methods +#ifdef DEBUG + virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE; +#endif + + // Rule methods + DECL_STYLE_RULE_INHERIT + virtual int32_t GetType() const MOZ_OVERRIDE; + virtual already_AddRefed Clone() const; + + // nsIDOMCSSRule interface + NS_DECL_NSIDOMCSSRULE + + // nsIDOMCSSCounterStyleRule + NS_DECL_NSIDOMCSSCOUNTERSTYLERULE + + // This function is only used to check whether a non-empty value, which has + // been accepted by parser, is valid for the given system and descriptor. + static bool CheckDescValue(int32_t aSystem, + nsCSSCounterDesc aDescID, + const nsCSSValue& aValue); + + const nsString& GetName() const { return mName; } + + uint32_t GetGeneration() const { return mGeneration; } + + int32_t GetSystem() const; + const nsCSSValue& GetSystemArgument() const; + + const nsCSSValue& GetDesc(nsCSSCounterDesc aDescID) const + { + NS_ABORT_IF_FALSE(aDescID >= 0 && aDescID < eCSSCounterDesc_COUNT, + "descriptor ID out of range"); + return mValues[aDescID]; + } + + void SetDesc(nsCSSCounterDesc aDescID, const nsCSSValue& aValue); + + virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE; + +private: + typedef NS_STDCALL_FUNCPROTO(nsresult, Getter, nsCSSCounterStyleRule, + GetSymbols, (nsAString&)); + static const Getter kGetters[]; + + nsresult GetDescriptor(nsCSSCounterDesc aDescID, nsAString& aValue); + nsresult SetDescriptor(nsCSSCounterDesc aDescID, const nsAString& aValue); + + nsString mName; + nsCSSValue mValues[eCSSCounterDesc_COUNT]; + uint32_t mGeneration; +}; + #endif /* !defined(nsCSSRules_h_) */ diff --git a/layout/style/nsCSSStyleSheet.cpp b/layout/style/nsCSSStyleSheet.cpp index 6d5227fe183..1d517484b9f 100644 --- a/layout/style/nsCSSStyleSheet.cpp +++ b/layout/style/nsCSSStyleSheet.cpp @@ -2042,6 +2042,7 @@ nsCSSStyleSheet::InsertRuleIntoGroup(const nsAString & aRule, case css::Rule::FONT_FACE_RULE: case css::Rule::PAGE_RULE: case css::Rule::KEYFRAMES_RULE: + case css::Rule::COUNTER_STYLE_RULE: case css::Rule::DOCUMENT_RULE: case css::Rule::SUPPORTS_RULE: // these types are OK to insert into a group diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h index f519da02be9..da9e03ec480 100644 --- a/layout/style/nsStyleConsts.h +++ b/layout/style/nsStyleConsts.h @@ -1057,6 +1057,22 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) { #define NS_STYLE_CONTROL_CHARACTER_VISIBILITY_HIDDEN 0 #define NS_STYLE_CONTROL_CHARACTER_VISIBILITY_VISIBLE 1 +// counter system +#define NS_STYLE_COUNTER_SYSTEM_CYCLIC 0 +#define NS_STYLE_COUNTER_SYSTEM_NUMERIC 1 +#define NS_STYLE_COUNTER_SYSTEM_ALPHABETIC 2 +#define NS_STYLE_COUNTER_SYSTEM_SYMBOLIC 3 +#define NS_STYLE_COUNTER_SYSTEM_ADDITIVE 4 +#define NS_STYLE_COUNTER_SYSTEM_FIXED 5 +#define NS_STYLE_COUNTER_SYSTEM_EXTENDS 6 + +#define NS_STYLE_COUNTER_RANGE_INFINITE 0 + +#define NS_STYLE_COUNTER_SPEAKAS_BULLETS 0 +#define NS_STYLE_COUNTER_SPEAKAS_NUMBERS 1 +#define NS_STYLE_COUNTER_SPEAKAS_WORDS 2 +#define NS_STYLE_COUNTER_SPEAKAS_SPELL_OUT 3 + /***************************************************************************** * Constants for media features. * *****************************************************************************/ diff --git a/layout/style/nsStyleSet.cpp b/layout/style/nsStyleSet.cpp index a322e98b1c3..c72bb74d167 100644 --- a/layout/style/nsStyleSet.cpp +++ b/layout/style/nsStyleSet.cpp @@ -1613,6 +1613,27 @@ nsStyleSet::KeyframesRuleForName(nsPresContext* aPresContext, return nullptr; } +nsCSSCounterStyleRule* +nsStyleSet::CounterStyleRuleForName(nsPresContext* aPresContext, + const nsAString& aName) +{ + NS_ENSURE_FALSE(mInShutdown, nullptr); + + for (uint32_t i = ArrayLength(gCSSSheetTypes); i-- != 0; ) { + if (gCSSSheetTypes[i] == eScopedDocSheet) + continue; + nsCSSRuleProcessor *ruleProc = static_cast + (mRuleProcessors[gCSSSheetTypes[i]].get()); + if (!ruleProc) + continue; + nsCSSCounterStyleRule *result = + ruleProc->CounterStyleRuleForName(aPresContext, aName); + if (result) + return result; + } + return nullptr; +} + bool nsStyleSet::AppendFontFeatureValuesRules(nsPresContext* aPresContext, nsTArray& aArray) diff --git a/layout/style/nsStyleSet.h b/layout/style/nsStyleSet.h index e778264ad86..30a52cd7c5a 100644 --- a/layout/style/nsStyleSet.h +++ b/layout/style/nsStyleSet.h @@ -30,6 +30,7 @@ class nsCSSFontFaceRule; class nsCSSKeyframesRule; class nsCSSFontFeatureValuesRule; class nsCSSPageRule; +class nsCSSCounterStyleRule; class nsRuleWalker; struct ElementDependentRuleProcessorData; struct TreeMatchContext; @@ -181,6 +182,10 @@ class nsStyleSet nsCSSKeyframesRule* KeyframesRuleForName(nsPresContext* aPresContext, const nsString& aName); + // Return the winning (in the cascade) @counter-style rule for the given name. + nsCSSCounterStyleRule* CounterStyleRuleForName(nsPresContext* aPresContext, + const nsAString& aName); + // Fetch object for looking up font feature values already_AddRefed GetFontFeatureValuesLookup(); From 482d688b239a384f0b9a1095f287f2c24c72efdb Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 11 Jun 2014 21:11:00 -0400 Subject: [PATCH 07/68] Bug 966166 - Part 2: Computation of counter style. r=dbaron --- layout/base/nsPresContext.cpp | 10 +- layout/base/nsPresContext.h | 6 + layout/build/nsLayoutStatics.cpp | 3 + layout/generic/nsBulletFrame.cpp | 8 +- layout/style/CounterStyleManager.cpp | 1632 ++++++++++++++++++++++++++ layout/style/CounterStyleManager.h | 139 +++ layout/style/moz.build | 1 + layout/style/nsStyleConsts.h | 3 + 8 files changed, 1797 insertions(+), 5 deletions(-) create mode 100644 layout/style/CounterStyleManager.cpp create mode 100644 layout/style/CounterStyleManager.h diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 64efd08fdd1..9b1bc08fa02 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -43,6 +43,7 @@ #include "nsObjectFrame.h" #include "nsTransitionManager.h" #include "nsAnimationManager.h" +#include "CounterStyleManager.h" #include "mozilla/MemoryReporting.h" #include "mozilla/dom/Element.h" #include "nsIMessageManager.h" @@ -964,9 +965,12 @@ nsPresContext::Init(nsDeviceContext* aDeviceContext) mAnimationManager = new nsAnimationManager(this); - // FIXME: Why is mozilla:: needed? + // Since there are methods in nsPresContext have the same name as the + // classes, it is necessary to prefix them with the namespace here. mRestyleManager = new mozilla::RestyleManager(this); + mCounterStyleManager = new mozilla::CounterStyleManager(this); + if (mDocument->GetDisplayDocument()) { NS_ASSERTION(mDocument->GetDisplayDocument()->GetShell() && mDocument->GetDisplayDocument()->GetShell()->GetPresContext(), @@ -1142,6 +1146,10 @@ nsPresContext::SetShell(nsIPresShell* aShell) mRestyleManager->Disconnect(); mRestyleManager = nullptr; } + if (mCounterStyleManager) { + mCounterStyleManager->Disconnect(); + mCounterStyleManager = nullptr; + } if (IsRoot()) { // Have to cancel our plugin geometry timer, because the diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 60e71fdda78..97de0cac8f6 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -69,6 +69,7 @@ class nsDeviceContext; namespace mozilla { class EventStateManager; class RestyleManager; +class CounterStyleManager; namespace dom { class MediaQueryList; } @@ -242,6 +243,10 @@ public: nsRefreshDriver* RefreshDriver() { return mRefreshDriver; } mozilla::RestyleManager* RestyleManager() { return mRestyleManager; } + + mozilla::CounterStyleManager* CounterStyleManager() { + return mCounterStyleManager; + } #endif /** @@ -1182,6 +1187,7 @@ protected: nsRefPtr mTransitionManager; nsRefPtr mAnimationManager; nsRefPtr mRestyleManager; + nsRefPtr mCounterStyleManager; nsIAtom* mMedium; // initialized by subclass ctors; // weak pointer to static atom nsCOMPtr mMediaEmulated; diff --git a/layout/build/nsLayoutStatics.cpp b/layout/build/nsLayoutStatics.cpp index e1b5e7f53ce..35a3756e817 100644 --- a/layout/build/nsLayoutStatics.cpp +++ b/layout/build/nsLayoutStatics.cpp @@ -63,6 +63,7 @@ #include "CacheObserver.h" #include "DisplayItemClip.h" #include "ActiveLayerTracker.h" +#include "CounterStyleManager.h" #include "AudioChannelService.h" #include "mozilla/dom/DataStoreService.h" @@ -293,6 +294,8 @@ nsLayoutStatics::Initialize() CacheObserver::Init(); + CounterStyleManager::InitializeBuiltinCounterStyles(); + return NS_OK; } diff --git a/layout/generic/nsBulletFrame.cpp b/layout/generic/nsBulletFrame.cpp index 3630ff7b4f0..c348cbd0988 100644 --- a/layout/generic/nsBulletFrame.cpp +++ b/layout/generic/nsBulletFrame.cpp @@ -799,7 +799,7 @@ struct CJKIdeographicData { uint8_t lang; bool informal; }; -static const char16_t gJapaneseNegative[] = { +extern const char16_t gJapaneseNegative[] = { 0x30de, 0x30a4, 0x30ca, 0x30b9, 0x0000 }; static const CJKIdeographicData gDataJapaneseInformal = { @@ -824,7 +824,7 @@ static const CJKIdeographicData gDataJapaneseFormal = { JAPANESE, // lang false // informal }; -static const char16_t gKoreanNegative[] = { +extern const char16_t gKoreanNegative[] = { 0xb9c8, 0xc774, 0xb108, 0xc2a4, 0x0020, 0x0000 }; static const CJKIdeographicData gDataKoreanHangulFormal = { @@ -860,7 +860,7 @@ static const CJKIdeographicData gDataKoreanHanjaFormal = { KOREAN, // lang false // informal }; -static const char16_t gSimpChineseNegative[] = { +extern const char16_t gSimpChineseNegative[] = { 0x8d1f, 0x0000 }; static const CJKIdeographicData gDataSimpChineseInformal = { @@ -885,7 +885,7 @@ static const CJKIdeographicData gDataSimpChineseFormal = { CHINESE, // lang false // informal }; -static const char16_t gTradChineseNegative[] = { +extern const char16_t gTradChineseNegative[] = { 0x8ca0, 0x0000 }; static const CJKIdeographicData gDataTradChineseInformal = { diff --git a/layout/style/CounterStyleManager.cpp b/layout/style/CounterStyleManager.cpp new file mode 100644 index 00000000000..5e4cc222c53 --- /dev/null +++ b/layout/style/CounterStyleManager.cpp @@ -0,0 +1,1632 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "CounterStyleManager.h" + +#include "mozilla/Types.h" +#include "mozilla/CheckedInt.h" +#include "mozilla/MathAlgorithms.h" +#include "mozilla/ArrayUtils.h" +#include "nsString.h" +#include "nsStyleSet.h" +#include "nsCSSRules.h" +#include "nsTArray.h" +#include "nsBulletFrame.h" +#include "nsTHashtable.h" +#include "nsUnicodeProperties.h" + +// XXX The following global constants are defined in nsBulletFrame.cpp +// They are temporarily referenced here. All counter text generating code should +// be moved here in some later patches. +extern const char16_t gJapaneseNegative[]; +extern const char16_t gKoreanNegative[]; +extern const char16_t gSimpChineseNegative[]; +extern const char16_t gTradChineseNegative[]; + +namespace mozilla { + +struct AdditiveSymbol +{ + CounterValue weight; + nsString symbol; +}; + +struct NegativeType +{ + nsString before, after; +}; + +struct PadType +{ + int32_t width; + nsString symbol; +}; + +// This limitation will be applied to some systems, and pad descriptor. +// Any initial representation generated by symbolic or additive which is +// longer than this limitation will be dropped. If any pad is longer +// than this, the whole counter text will be dropped as well. +// The spec requires user agents to support at least 60 Unicode code- +// points for counter text. However, this constant only limits the +// length in 16-bit units. So it has to be at least 120, since code- +// points outside the BMP will need 2 16-bit units. +#define LENGTH_LIMIT 150 + +static bool +GetCyclicCounterText(CounterValue aOrdinal, + nsSubstring& aResult, + const nsTArray& aSymbols) +{ + NS_ABORT_IF_FALSE(aSymbols.Length() >= 1, + "No symbol available for cyclic counter."); + auto n = aSymbols.Length(); + CounterValue index = (aOrdinal - 1) % n; + aResult = aSymbols[index >= 0 ? index : index + n]; + return true; +} + +static bool +GetFixedCounterText(CounterValue aOrdinal, + nsSubstring& aResult, + CounterValue aStart, + const nsTArray& aSymbols) +{ + CounterValue index = aOrdinal - aStart; + if (index >= 0 && index < CounterValue(aSymbols.Length())) { + aResult = aSymbols[index]; + return true; + } else { + return false; + } +} + +static bool +GetSymbolicCounterText(CounterValue aOrdinal, + nsSubstring& aResult, + const nsTArray& aSymbols) +{ + NS_ABORT_IF_FALSE(aSymbols.Length() >= 1, + "No symbol available for symbolic counter."); + NS_ABORT_IF_FALSE(aOrdinal >= 0, "Invalid ordinal."); + if (aOrdinal == 0) { + return false; + } + + aResult.Truncate(); + auto n = aSymbols.Length(); + const nsString& symbol = aSymbols[(aOrdinal - 1) % n]; + size_t len = (aOrdinal + n - 1) / n; + auto symbolLength = symbol.Length(); + if (symbolLength > 0) { + if (len > LENGTH_LIMIT || symbolLength > LENGTH_LIMIT || + len * symbolLength > LENGTH_LIMIT) { + return false; + } + for (size_t i = 0; i < len; ++i) { + aResult.Append(symbol); + } + } + return true; +} + +static bool +GetAlphabeticCounterText(CounterValue aOrdinal, + nsSubstring& aResult, + const nsTArray& aSymbols) +{ + NS_ABORT_IF_FALSE(aSymbols.Length() >= 2, + "Too few symbols for alphabetic counter."); + NS_ABORT_IF_FALSE(aOrdinal >= 0, "Invalid ordinal."); + if (aOrdinal == 0) { + return false; + } + + auto n = aSymbols.Length(); + // The precise length of this array should be + // ceil(log((double) aOrdinal / n * (n - 1) + 1) / log(n)). + // The max length is slightly smaller than which defined below. + nsAutoTArray::digits> indexes; + while (aOrdinal > 0) { + --aOrdinal; + indexes.AppendElement(aOrdinal % n); + aOrdinal /= n; + } + + aResult.Truncate(); + for (auto i = indexes.Length(); i > 0; --i) { + aResult.Append(aSymbols[indexes[i - 1]]); + } + return true; +} + +static bool +GetNumericCounterText(CounterValue aOrdinal, + nsSubstring& aResult, + const nsTArray& aSymbols) +{ + NS_ABORT_IF_FALSE(aSymbols.Length() >= 2, + "Too few symbols for numeric counter."); + NS_ABORT_IF_FALSE(aOrdinal >= 0, "Invalid ordinal."); + + if (aOrdinal == 0) { + aResult = aSymbols[0]; + return true; + } + + auto n = aSymbols.Length(); + nsAutoTArray::digits> indexes; + while (aOrdinal > 0) { + indexes.AppendElement(aOrdinal % n); + aOrdinal /= n; + } + + aResult.Truncate(); + for (auto i = indexes.Length(); i > 0; --i) { + aResult.Append(aSymbols[indexes[i - 1]]); + } + return true; +} + +static bool +GetAdditiveCounterText(CounterValue aOrdinal, + nsSubstring& aResult, + const nsTArray& aSymbols) +{ + NS_ABORT_IF_FALSE(aOrdinal >= 0, "Invalid ordinal."); + + if (aOrdinal == 0) { + const AdditiveSymbol& last = aSymbols.LastElement(); + if (last.weight == 0) { + aResult = last.symbol; + return true; + } + return false; + } + + aResult.Truncate(); + size_t length = 0; + for (size_t i = 0, iEnd = aSymbols.Length(); i < iEnd; ++i) { + const AdditiveSymbol& symbol = aSymbols[i]; + if (symbol.weight == 0) { + break; + } + CounterValue times = aOrdinal / symbol.weight; + if (times > 0) { + auto symbolLength = symbol.symbol.Length(); + if (symbolLength > 0) { + length += times * symbolLength; + if (times > LENGTH_LIMIT || + symbolLength > LENGTH_LIMIT || + length > LENGTH_LIMIT) { + return false; + } + for (CounterValue j = 0; j < times; ++j) { + aResult.Append(symbol.symbol); + } + } + aOrdinal -= times * symbol.weight; + } + } + return aOrdinal == 0; +} + +class BuiltinCounterStyle : public CounterStyle +{ +public: + friend class CounterStyleManager; + + // will be initialized by CounterStyleManager::InitializeBuiltinCounterStyles + MOZ_CONSTEXPR BuiltinCounterStyle() + : CounterStyle(NS_STYLE_LIST_STYLE_NONE) + { + } + +protected: + MOZ_CONSTEXPR BuiltinCounterStyle(int32_t aStyle) + : CounterStyle(aStyle) + { + } + +public: + virtual void GetPrefix(nsSubstring& aResult) MOZ_OVERRIDE; + virtual void GetSuffix(nsSubstring& aResult) MOZ_OVERRIDE; + virtual void GetSpokenCounterText(CounterValue aOrdinal, + nsSubstring& aResult, + bool& aIsBullet) MOZ_OVERRIDE; + virtual bool IsBullet() MOZ_OVERRIDE; + + virtual void GetNegative(NegativeType& aResult) MOZ_OVERRIDE; + virtual bool IsOrdinalInRange(CounterValue aOrdinal) MOZ_OVERRIDE; + virtual bool IsOrdinalInAutoRange(CounterValue aOrdinal) MOZ_OVERRIDE; + virtual void GetPad(PadType& aResult) MOZ_OVERRIDE; + virtual CounterStyle* GetFallback() MOZ_OVERRIDE; + virtual uint8_t GetSpeakAs() MOZ_OVERRIDE; + virtual bool UseNegativeSign() MOZ_OVERRIDE; + + virtual void CallFallbackStyle(CounterValue aOrdinal, + nsSubstring& aResult, + bool& aIsRTL) MOZ_OVERRIDE; + virtual bool GetInitialCounterText(CounterValue aOrdinal, + nsSubstring& aResult, + bool& aIsRTL) MOZ_OVERRIDE; + + // Builtin counter style does not need refcount at all + NS_IMETHOD_(MozExternalRefCountType) AddRef() MOZ_OVERRIDE { return 2; } + NS_IMETHOD_(MozExternalRefCountType) Release() MOZ_OVERRIDE { return 2; } +}; + +/* virtual */ void +BuiltinCounterStyle::GetPrefix(nsSubstring& aResult) +{ + aResult.Truncate(); +} + +/* virtual */ void +BuiltinCounterStyle::GetSuffix(nsSubstring& aResult) +{ + // XXX nsBulletFrame::GetListItemSuffix accepts only nsString&, so we reassign + // the result here. This could be avoided when the whole code is moved here. + nsAutoString result; + nsBulletFrame::GetListItemSuffix(mStyle, result); + aResult = result; +} + +// XXX stolen from nsBlockFrame.cpp +static const char16_t kDiscCharacter = 0x2022; +static const char16_t kCircleCharacter = 0x25e6; +static const char16_t kSquareCharacter = 0x25aa; + +/* virtual */ void +BuiltinCounterStyle::GetSpokenCounterText(CounterValue aOrdinal, + nsSubstring& aResult, + bool& aIsBullet) +{ + switch (mStyle) { + case NS_STYLE_LIST_STYLE_NONE: + aResult.Truncate(); + aIsBullet = true; + break; + case NS_STYLE_LIST_STYLE_DISC: + aResult.Assign(kDiscCharacter); + aIsBullet = true; + break; + case NS_STYLE_LIST_STYLE_CIRCLE: + aResult.Assign(kCircleCharacter); + aIsBullet = true; + break; + case NS_STYLE_LIST_STYLE_SQUARE: + aResult.Assign(kSquareCharacter); + aIsBullet = true; + break; + default: + CounterStyle::GetSpokenCounterText(aOrdinal, aResult, aIsBullet); + aIsBullet = false; + break; + } +} + +/* virtual */ bool +BuiltinCounterStyle::IsBullet() +{ + switch (mStyle) { + case NS_STYLE_LIST_STYLE_DISC: + case NS_STYLE_LIST_STYLE_CIRCLE: + case NS_STYLE_LIST_STYLE_SQUARE: + return true; + default: + return false; + } +} + +/* virtual */ void +BuiltinCounterStyle::GetNegative(NegativeType& aResult) +{ + switch (mStyle) { + case NS_STYLE_LIST_STYLE_JAPANESE_FORMAL: + case NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL: + case NS_STYLE_LIST_STYLE_MOZ_JAPANESE_FORMAL: + case NS_STYLE_LIST_STYLE_MOZ_JAPANESE_INFORMAL: + aResult.before = gJapaneseNegative; + break; + + case NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL: + case NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL: + case NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL: + aResult.before = gKoreanNegative; + break; + + case NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL: + case NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL: + case NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_FORMAL: + case NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_INFORMAL: + aResult.before = gSimpChineseNegative; + break; + + case NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC: + case NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL: + case NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL: + case NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_FORMAL: + case NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_INFORMAL: + aResult.before = gTradChineseNegative; + break; + + default: + aResult.before.AssignLiteral(MOZ_UTF16("-")); + } + aResult.after.Truncate(); +} + +/* virtual */ bool +BuiltinCounterStyle::IsOrdinalInRange(CounterValue aOrdinal) +{ + switch (mStyle) { + default: + // cyclic + case NS_STYLE_LIST_STYLE_NONE: + case NS_STYLE_LIST_STYLE_DISC: + case NS_STYLE_LIST_STYLE_CIRCLE: + case NS_STYLE_LIST_STYLE_SQUARE: + // use DecimalToText + case NS_STYLE_LIST_STYLE_DECIMAL: + case NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO: + // use CJKIdeographicToText + case NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC: + case NS_STYLE_LIST_STYLE_JAPANESE_FORMAL: + case NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL: + case NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL: + case NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL: + case NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL: + case NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL: + case NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL: + case NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL: + case NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL: + case NS_STYLE_LIST_STYLE_MOZ_JAPANESE_FORMAL: + case NS_STYLE_LIST_STYLE_MOZ_JAPANESE_INFORMAL: + case NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_FORMAL: + case NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_INFORMAL: + case NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_FORMAL: + case NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_INFORMAL: + // use OtherDecimalToText + case NS_STYLE_LIST_STYLE_MOZ_ARABIC_INDIC: + case NS_STYLE_LIST_STYLE_MOZ_PERSIAN: + case NS_STYLE_LIST_STYLE_MOZ_URDU: + case NS_STYLE_LIST_STYLE_MOZ_DEVANAGARI: + case NS_STYLE_LIST_STYLE_MOZ_GURMUKHI: + case NS_STYLE_LIST_STYLE_MOZ_GUJARATI: + case NS_STYLE_LIST_STYLE_MOZ_ORIYA: + case NS_STYLE_LIST_STYLE_MOZ_KANNADA: + case NS_STYLE_LIST_STYLE_MOZ_MALAYALAM: + case NS_STYLE_LIST_STYLE_MOZ_THAI: + case NS_STYLE_LIST_STYLE_MOZ_LAO: + case NS_STYLE_LIST_STYLE_MOZ_MYANMAR: + case NS_STYLE_LIST_STYLE_MOZ_KHMER: + case NS_STYLE_LIST_STYLE_MOZ_BENGALI: + case NS_STYLE_LIST_STYLE_MOZ_TELUGU: + return true; + + // use CharListDecimalToText + case NS_STYLE_LIST_STYLE_CJK_DECIMAL: + return aOrdinal >= 0; + + // use RomanToText + case NS_STYLE_LIST_STYLE_LOWER_ROMAN: + case NS_STYLE_LIST_STYLE_UPPER_ROMAN: + return aOrdinal >= 1 && aOrdinal <= 3999; + + // use CharListToText + case NS_STYLE_LIST_STYLE_LOWER_ALPHA: + case NS_STYLE_LIST_STYLE_UPPER_ALPHA: + case NS_STYLE_LIST_STYLE_KATAKANA: + case NS_STYLE_LIST_STYLE_HIRAGANA: + case NS_STYLE_LIST_STYLE_KATAKANA_IROHA: + case NS_STYLE_LIST_STYLE_HIRAGANA_IROHA: + case NS_STYLE_LIST_STYLE_LOWER_GREEK: + case NS_STYLE_LIST_STYLE_MOZ_CJK_HEAVENLY_STEM: + case NS_STYLE_LIST_STYLE_MOZ_CJK_EARTHLY_BRANCH: + case NS_STYLE_LIST_STYLE_MOZ_HANGUL: + case NS_STYLE_LIST_STYLE_MOZ_HANGUL_CONSONANT: + case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME: + case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_AM: + case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ER: + case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ET: + // use EthiopicToText + case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_NUMERIC: + return aOrdinal >= 1; + + // use HebrewToText + case NS_STYLE_LIST_STYLE_HEBREW: + return aOrdinal >= 1 && aOrdinal <= 999999; + + // use ArmenianToText + case NS_STYLE_LIST_STYLE_ARMENIAN: + // use TamilToText + case NS_STYLE_LIST_STYLE_MOZ_TAMIL: + return aOrdinal >= 1 && aOrdinal <= 9999; + + // use GeorgianToText + case NS_STYLE_LIST_STYLE_GEORGIAN: + return aOrdinal >= 1 && aOrdinal <= 19999; + } +} + +/* virtual */ bool +BuiltinCounterStyle::IsOrdinalInAutoRange(CounterValue aOrdinal) +{ + switch (mStyle) { + // cyclic: + case NS_STYLE_LIST_STYLE_NONE: + case NS_STYLE_LIST_STYLE_DISC: + case NS_STYLE_LIST_STYLE_CIRCLE: + case NS_STYLE_LIST_STYLE_SQUARE: + // numeric: + case NS_STYLE_LIST_STYLE_DECIMAL: + case NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO: + case NS_STYLE_LIST_STYLE_CJK_DECIMAL: + case NS_STYLE_LIST_STYLE_MOZ_ARABIC_INDIC: + case NS_STYLE_LIST_STYLE_MOZ_PERSIAN: + case NS_STYLE_LIST_STYLE_MOZ_URDU: + case NS_STYLE_LIST_STYLE_MOZ_DEVANAGARI: + case NS_STYLE_LIST_STYLE_MOZ_GURMUKHI: + case NS_STYLE_LIST_STYLE_MOZ_GUJARATI: + case NS_STYLE_LIST_STYLE_MOZ_ORIYA: + case NS_STYLE_LIST_STYLE_MOZ_KANNADA: + case NS_STYLE_LIST_STYLE_MOZ_MALAYALAM: + case NS_STYLE_LIST_STYLE_MOZ_THAI: + case NS_STYLE_LIST_STYLE_MOZ_LAO: + case NS_STYLE_LIST_STYLE_MOZ_MYANMAR: + case NS_STYLE_LIST_STYLE_MOZ_KHMER: + case NS_STYLE_LIST_STYLE_MOZ_BENGALI: + case NS_STYLE_LIST_STYLE_MOZ_TELUGU: + // fixed: no predefined counter style + return true; + + // alphabetic: + case NS_STYLE_LIST_STYLE_LOWER_ALPHA: + case NS_STYLE_LIST_STYLE_UPPER_ALPHA: + case NS_STYLE_LIST_STYLE_LOWER_GREEK: + case NS_STYLE_LIST_STYLE_KATAKANA: + case NS_STYLE_LIST_STYLE_HIRAGANA: + case NS_STYLE_LIST_STYLE_KATAKANA_IROHA: + case NS_STYLE_LIST_STYLE_HIRAGANA_IROHA: + case NS_STYLE_LIST_STYLE_MOZ_CJK_HEAVENLY_STEM: + case NS_STYLE_LIST_STYLE_MOZ_CJK_EARTHLY_BRANCH: + case NS_STYLE_LIST_STYLE_MOZ_HANGUL: + case NS_STYLE_LIST_STYLE_MOZ_HANGUL_CONSONANT: + case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME: + case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_AM: + case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ER: + case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ET: + // symbolic: no predefined counter style + return aOrdinal >= 1; + + // additive: + case NS_STYLE_LIST_STYLE_LOWER_ROMAN: + case NS_STYLE_LIST_STYLE_UPPER_ROMAN: + case NS_STYLE_LIST_STYLE_ARMENIAN: + case NS_STYLE_LIST_STYLE_GEORGIAN: + case NS_STYLE_LIST_STYLE_HEBREW: + return aOrdinal >= 0; + + // complex predefined: + case NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC: + case NS_STYLE_LIST_STYLE_JAPANESE_FORMAL: + case NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL: + case NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL: + case NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL: + case NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL: + case NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL: + case NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL: + case NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL: + case NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL: + case NS_STYLE_LIST_STYLE_MOZ_JAPANESE_FORMAL: + case NS_STYLE_LIST_STYLE_MOZ_JAPANESE_INFORMAL: + case NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_FORMAL: + case NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_INFORMAL: + case NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_FORMAL: + case NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_INFORMAL: + case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_NUMERIC: + case NS_STYLE_LIST_STYLE_MOZ_TAMIL: + return IsOrdinalInRange(aOrdinal); + + default: + NS_NOTREACHED("Unknown counter style"); + return false; + } +} + +/* virtual */ void +BuiltinCounterStyle::GetPad(PadType& aResult) +{ + switch (mStyle) { + case NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO: + aResult.width = 2; + aResult.symbol.AssignLiteral(MOZ_UTF16("0")); + break; + default: + aResult.width = 0; + aResult.symbol.Truncate(); + break; + } +} + +/* virtual */ CounterStyle* +BuiltinCounterStyle::GetFallback() +{ + // Fallback of dependent builtin counter styles are handled in class + // DependentBuiltinCounterStyle. + return CounterStyleManager::GetDecimalStyle(); +} + +/* virtual */ uint8_t +BuiltinCounterStyle::GetSpeakAs() +{ + switch (mStyle) { + case NS_STYLE_LIST_STYLE_NONE: + case NS_STYLE_LIST_STYLE_DISC: + case NS_STYLE_LIST_STYLE_CIRCLE: + case NS_STYLE_LIST_STYLE_SQUARE: + return NS_STYLE_COUNTER_SPEAKAS_BULLETS; + case NS_STYLE_LIST_STYLE_LOWER_ALPHA: + case NS_STYLE_LIST_STYLE_UPPER_ALPHA: + case NS_STYLE_LIST_STYLE_KATAKANA: + case NS_STYLE_LIST_STYLE_HIRAGANA: + case NS_STYLE_LIST_STYLE_KATAKANA_IROHA: + case NS_STYLE_LIST_STYLE_HIRAGANA_IROHA: + case NS_STYLE_LIST_STYLE_LOWER_GREEK: + return NS_STYLE_COUNTER_SPEAKAS_SPELL_OUT; + default: + return NS_STYLE_COUNTER_SPEAKAS_NUMBERS; + } +} + +/* virtual */ bool +BuiltinCounterStyle::UseNegativeSign() +{ + switch (mStyle) { + case NS_STYLE_LIST_STYLE_NONE: + case NS_STYLE_LIST_STYLE_DISC: + case NS_STYLE_LIST_STYLE_CIRCLE: + case NS_STYLE_LIST_STYLE_SQUARE: + return false; + default: + return true; + } +} + +/* virtual */ void +BuiltinCounterStyle::CallFallbackStyle(CounterValue aOrdinal, + nsSubstring& aResult, + bool& aIsRTL) +{ + GetFallback()->GetCounterText(aOrdinal, aResult, aIsRTL); +} + +/* virtual */ bool +BuiltinCounterStyle::GetInitialCounterText(CounterValue aOrdinal, + nsSubstring& aResult, + bool& aIsRTL) +{ + // Since nsBulletFrame::AppendCounterText use nsString& as parameter, we + // have to reassign it. + nsAutoString result; + nsBulletFrame::AppendCounterText(mStyle, aOrdinal, result, aIsRTL); + aResult = result; + // Out-of-range ordinals should have been filtered out before invoking this + // function. Since all builtin styles are defined in a continuous range, + // no extendable fallback should have happend inside the function above, + // consequently this method will always succeed. + return true; +} + +class DependentBuiltinCounterStyle MOZ_FINAL : public BuiltinCounterStyle +{ +public: + DependentBuiltinCounterStyle(int32_t aStyle, CounterStyleManager* aManager) + : BuiltinCounterStyle(aStyle), + mManager(aManager) + { + NS_ASSERTION(IsDependentStyle(), "Not a dependent builtin style"); + NS_ABORT_IF_FALSE(!IsCustomStyle(), "Not a builtin style"); + } + + virtual CounterStyle* GetFallback() MOZ_OVERRIDE; + + // DependentBuiltinCounterStyle is managed in the same way as + // CustomCounterStyle. + NS_INLINE_DECL_REFCOUNTING(DependentBuiltinCounterStyle) + +private: + CounterStyleManager* mManager; +}; + +/* virtual */ CounterStyle* +DependentBuiltinCounterStyle::GetFallback() +{ + switch (GetStyle()) { + case NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL: + case NS_STYLE_LIST_STYLE_JAPANESE_FORMAL: + case NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL: + case NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL: + case NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL: + case NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL: + case NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL: + case NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL: + case NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL: + // These styles all have a larger range than cjk-decimal, so the + // only case fallback is accessed is that they are extended. + // Since extending styles will cache the data themselves, we need + // not cache it here. + return mManager->BuildCounterStyle(NS_LITERAL_STRING("cjk-decimal")); + default: + NS_NOTREACHED("Not a valid dependent builtin style"); + return BuiltinCounterStyle::GetFallback(); + } +} + +class CustomCounterStyle MOZ_FINAL : public CounterStyle +{ +public: + CustomCounterStyle(CounterStyleManager* aManager, + nsCSSCounterStyleRule* aRule) + : CounterStyle(NS_STYLE_LIST_STYLE_CUSTOM), + mManager(aManager), + mRule(aRule), + mRuleGeneration(aRule->GetGeneration()), + mSystem(aRule->GetSystem()), + mFlags(0), + mFallback(nullptr), + mSpeakAsCounter(nullptr), + mExtends(nullptr), + mExtendsRoot(nullptr) + { + } + + // This method will clear all cached data in the style and update the + // generation number of the rule. It should be called when the rule of + // this style is changed. + void ResetCachedData(); + + // This method will reset all cached data which may depend on other + // counter style. It will reset all pointers to other counter styles. + // For counter style extends other, in addition, all fields will be + // reset to uninitialized state. This method should be called when any + // other counter style is added, removed, or changed. + void ResetDependentData(); + + nsCSSCounterStyleRule* GetRule() const { return mRule; } + uint32_t GetRuleGeneration() const { return mRuleGeneration; } + + virtual void GetPrefix(nsSubstring& aResult) MOZ_OVERRIDE; + virtual void GetSuffix(nsSubstring& aResult) MOZ_OVERRIDE; + virtual void GetSpokenCounterText(CounterValue aOrdinal, + nsSubstring& aResult, + bool& aIsBullet) MOZ_OVERRIDE; + virtual bool IsBullet() MOZ_OVERRIDE; + + virtual void GetNegative(NegativeType& aResult) MOZ_OVERRIDE; + virtual bool IsOrdinalInRange(CounterValue aOrdinal) MOZ_OVERRIDE; + virtual bool IsOrdinalInAutoRange(CounterValue aOrdinal) MOZ_OVERRIDE; + virtual void GetPad(PadType& aResult) MOZ_OVERRIDE; + virtual CounterStyle* GetFallback() MOZ_OVERRIDE; + virtual uint8_t GetSpeakAs() MOZ_OVERRIDE; + virtual bool UseNegativeSign() MOZ_OVERRIDE; + + virtual void CallFallbackStyle(CounterValue aOrdinal, + nsSubstring& aResult, + bool& aIsRTL) MOZ_OVERRIDE; + virtual bool GetInitialCounterText(CounterValue aOrdinal, + nsSubstring& aResult, + bool& aIsRTL) MOZ_OVERRIDE; + + bool IsExtendsSystem() + { + return mSystem == NS_STYLE_COUNTER_SYSTEM_EXTENDS; + } + + // CustomCounterStyle should be reference-counted because it may be + // dereferenced from the manager but still referenced by nodes and + // frames before the style change is propagated. + NS_INLINE_DECL_REFCOUNTING(CustomCounterStyle) + +private: + const nsTArray& GetSymbols(); + const nsTArray& GetAdditiveSymbols(); + + // The speak-as values of counter styles may form a loop, and the + // loops may have complex interaction with the loop formed by + // extending. To solve this problem, the computation of speak-as is + // divided into two phases: + // 1. figure out the raw value, by ComputeRawSpeakAs, and + // 2. eliminate loop, by ComputeSpeakAs. + // See comments before the definitions of these methods for details. + uint8_t GetSpeakAsAutoValue(); + void ComputeRawSpeakAs(uint8_t& aSpeakAs, + CounterStyle*& aSpeakAsCounter); + CounterStyle* ComputeSpeakAs(); + + CounterStyle* ComputeExtends(); + CounterStyle* GetExtends(); + CounterStyle* GetExtendsRoot(); + + // CounterStyleManager should always overlive any CounterStyle as it + // is owned by nsPresContext, and will be released after all nodes and + // frames are released. + CounterStyleManager* mManager; + + nsRefPtr mRule; + uint32_t mRuleGeneration; + + uint8_t mSystem; + uint8_t mSpeakAs; + + enum { + // loop detection + FLAG_EXTENDS_VISITED = 1 << 0, + FLAG_EXTENDS_LOOP = 1 << 1, + FLAG_SPEAKAS_VISITED = 1 << 2, + FLAG_SPEAKAS_LOOP = 1 << 3, + // field status + FLAG_NEGATIVE_INITED = 1 << 4, + FLAG_PREFIX_INITED = 1 << 5, + FLAG_SUFFIX_INITED = 1 << 6, + FLAG_PAD_INITED = 1 << 7, + FLAG_SPEAKAS_INITED = 1 << 8, + }; + uint16_t mFlags; + + // Fields below will be initialized when necessary. + nsTArray mSymbols; + nsTArray mAdditiveSymbols; + NegativeType mNegative; + nsString mPrefix, mSuffix; + PadType mPad; + + // CounterStyleManager will guarantee that none of the pointers below + // refers to a freed CounterStyle. There are two possible cases where + // the manager will release its reference to a CounterStyle: 1. the + // manager itself is released, 2. a rule is invalidated. In the first + // case, all counter style are removed from the manager, and should + // also have been dereferenced from other objects. All styles will be + // released all together. In the second case, CounterStyleManager:: + // NotifyRuleChanged will guarantee that all pointers will be reset + // before any CounterStyle is released. + + CounterStyle* mFallback; + // This field refers to the last counter in a speak-as chain. + // That counter must not speak as another counter. + CounterStyle* mSpeakAsCounter; + + CounterStyle* mExtends; + // This field refers to the last counter in the extends chain. The + // counter must be either a builtin style or a style whose system is + // not 'extends'. + CounterStyle* mExtendsRoot; +}; + +void +CustomCounterStyle::ResetCachedData() +{ + mSymbols.Clear(); + mAdditiveSymbols.Clear(); + mFlags &= ~(FLAG_NEGATIVE_INITED | + FLAG_PREFIX_INITED | + FLAG_SUFFIX_INITED | + FLAG_PAD_INITED | + FLAG_SPEAKAS_INITED); + mFallback = nullptr; + mSpeakAsCounter = nullptr; + mExtends = nullptr; + mExtendsRoot = nullptr; + mRuleGeneration = mRule->GetGeneration(); +} + +void +CustomCounterStyle::ResetDependentData() +{ + mFlags &= ~FLAG_SPEAKAS_INITED; + mSpeakAsCounter = nullptr; + mFallback = nullptr; + mExtends = nullptr; + mExtendsRoot = nullptr; + if (IsExtendsSystem()) { + mFlags &= ~(FLAG_NEGATIVE_INITED | + FLAG_PREFIX_INITED | + FLAG_SUFFIX_INITED | + FLAG_PAD_INITED); + } +} + +/* virtual */ void +CustomCounterStyle::GetPrefix(nsSubstring& aResult) +{ + if (!(mFlags & FLAG_PREFIX_INITED)) { + mFlags |= FLAG_PREFIX_INITED; + + const nsCSSValue& value = mRule->GetDesc(eCSSCounterDesc_Prefix); + if (value.UnitHasStringValue()) { + value.GetStringValue(mPrefix); + } else if (IsExtendsSystem()) { + GetExtends()->GetPrefix(mPrefix); + } else { + mPrefix.Truncate(); + } + } + aResult = mPrefix; +} + +/* virtual */ void +CustomCounterStyle::GetSuffix(nsSubstring& aResult) +{ + if (!(mFlags & FLAG_SUFFIX_INITED)) { + mFlags |= FLAG_SUFFIX_INITED; + + const nsCSSValue& value = mRule->GetDesc(eCSSCounterDesc_Suffix); + if (value.UnitHasStringValue()) { + value.GetStringValue(mSuffix); + } else if (IsExtendsSystem()) { + GetExtends()->GetSuffix(mSuffix); + } else { + mSuffix.AssignLiteral(MOZ_UTF16(". ")); + } + } + aResult = mSuffix; +} + +/* virtual */ void +CustomCounterStyle::GetSpokenCounterText(CounterValue aOrdinal, + nsSubstring& aResult, + bool& aIsBullet) +{ + if (GetSpeakAs() != NS_STYLE_COUNTER_SPEAKAS_OTHER) { + CounterStyle::GetSpokenCounterText(aOrdinal, aResult, aIsBullet); + } else { + NS_ABORT_IF_FALSE(mSpeakAsCounter, + "mSpeakAsCounter should have been initialized."); + mSpeakAsCounter->GetSpokenCounterText(aOrdinal, aResult, aIsBullet); + } +} + +/* virtual */ bool +CustomCounterStyle::IsBullet() +{ + switch (mSystem) { + case NS_STYLE_COUNTER_SYSTEM_CYCLIC: + // Only use ::-moz-list-bullet for cyclic system + return true; + case NS_STYLE_COUNTER_SYSTEM_EXTENDS: + return GetExtendsRoot()->IsBullet(); + default: + return false; + } +} + +/* virtual */ void +CustomCounterStyle::GetNegative(NegativeType& aResult) +{ + if (!(mFlags & FLAG_NEGATIVE_INITED)) { + mFlags |= FLAG_NEGATIVE_INITED; + const nsCSSValue& value = mRule->GetDesc(eCSSCounterDesc_Negative); + switch (value.GetUnit()) { + case eCSSUnit_Ident: + case eCSSUnit_String: + value.GetStringValue(mNegative.before); + mNegative.after.Truncate(); + break; + case eCSSUnit_Pair: { + const nsCSSValuePair& pair = value.GetPairValue(); + pair.mXValue.GetStringValue(mNegative.before); + pair.mYValue.GetStringValue(mNegative.after); + break; + } + default: { + if (IsExtendsSystem()) { + GetExtends()->GetNegative(mNegative); + } else { + mNegative.before.AssignLiteral(MOZ_UTF16("-")); + mNegative.after.Truncate(); + } + } + } + } + aResult = mNegative; +} + +static inline bool +IsRangeValueInfinite(const nsCSSValue& aValue) +{ + return aValue.GetUnit() == eCSSUnit_Enumerated && + aValue.GetIntValue() == NS_STYLE_COUNTER_RANGE_INFINITE; +} + +/* virtual */ bool +CustomCounterStyle::IsOrdinalInRange(CounterValue aOrdinal) +{ + const nsCSSValue& value = mRule->GetDesc(eCSSCounterDesc_Range); + if (value.GetUnit() == eCSSUnit_PairList) { + for (const nsCSSValuePairList* item = value.GetPairListValue(); + item != nullptr; item = item->mNext) { + const nsCSSValue& lowerBound = item->mXValue; + const nsCSSValue& upperBound = item->mYValue; + if ((IsRangeValueInfinite(lowerBound) || + aOrdinal >= lowerBound.GetIntValue()) && + (IsRangeValueInfinite(upperBound) || + aOrdinal <= upperBound.GetIntValue())) { + return true; + } + } + return false; + } else if (IsExtendsSystem() && value.GetUnit() == eCSSUnit_None) { + // Only use the range of extended style when 'range' is not specified. + return GetExtends()->IsOrdinalInRange(aOrdinal); + } + return IsOrdinalInAutoRange(aOrdinal); +} + +/* virtual */ bool +CustomCounterStyle::IsOrdinalInAutoRange(CounterValue aOrdinal) +{ + switch (mSystem) { + case NS_STYLE_COUNTER_SYSTEM_CYCLIC: + case NS_STYLE_COUNTER_SYSTEM_NUMERIC: + case NS_STYLE_COUNTER_SYSTEM_FIXED: + return true; + case NS_STYLE_COUNTER_SYSTEM_ALPHABETIC: + case NS_STYLE_COUNTER_SYSTEM_SYMBOLIC: + return aOrdinal >= 1; + case NS_STYLE_COUNTER_SYSTEM_ADDITIVE: + return aOrdinal >= 0; + case NS_STYLE_COUNTER_SYSTEM_EXTENDS: + return GetExtendsRoot()->IsOrdinalInAutoRange(aOrdinal); + default: + NS_NOTREACHED("Invalid system for computing auto value."); + return false; + } +} + +/* virtual */ void +CustomCounterStyle::GetPad(PadType& aResult) +{ + if (!(mFlags & FLAG_PAD_INITED)) { + mFlags |= FLAG_PAD_INITED; + const nsCSSValue& value = mRule->GetDesc(eCSSCounterDesc_Pad); + if (value.GetUnit() == eCSSUnit_Pair) { + const nsCSSValuePair& pair = value.GetPairValue(); + mPad.width = pair.mXValue.GetIntValue(); + pair.mYValue.GetStringValue(mPad.symbol); + } else if (IsExtendsSystem()) { + GetExtends()->GetPad(mPad); + } else { + mPad.width = 0; + mPad.symbol.Truncate(); + } + } + aResult = mPad; +} + +/* virtual */ CounterStyle* +CustomCounterStyle::GetFallback() +{ + if (!mFallback) { + const nsCSSValue& value = mRule->GetDesc(eCSSCounterDesc_Fallback); + if (value.UnitHasStringValue()) { + mFallback = mManager->BuildCounterStyle( + nsDependentString(value.GetStringBufferValue())); + } else if (IsExtendsSystem()) { + mFallback = GetExtends()->GetFallback(); + } else { + mFallback = CounterStyleManager::GetDecimalStyle(); + } + } + return mFallback; +} + +/* virtual */ uint8_t +CustomCounterStyle::GetSpeakAs() +{ + if (!(mFlags & FLAG_SPEAKAS_INITED)) { + ComputeSpeakAs(); + } + return mSpeakAs; +} + +/* virtual */ bool +CustomCounterStyle::UseNegativeSign() +{ + switch (mSystem) { + case NS_STYLE_COUNTER_SYSTEM_SYMBOLIC: + case NS_STYLE_COUNTER_SYSTEM_ALPHABETIC: + case NS_STYLE_COUNTER_SYSTEM_NUMERIC: + case NS_STYLE_COUNTER_SYSTEM_ADDITIVE: + return true; + case NS_STYLE_COUNTER_SYSTEM_EXTENDS: + return GetExtendsRoot()->UseNegativeSign(); + default: + return false; + } +} + +/* virtual */ void +CustomCounterStyle::CallFallbackStyle(CounterValue aOrdinal, + nsSubstring& aResult, + bool& aIsRTL) +{ + CounterStyle* fallback = GetFallback(); + // If it recursively falls back to this counter style again, + // it will then fallback to decimal to break the loop. + mFallback = CounterStyleManager::GetDecimalStyle(); + fallback->GetCounterText(aOrdinal, aResult, aIsRTL); + mFallback = fallback; +} + +/* virtual */ bool +CustomCounterStyle::GetInitialCounterText(CounterValue aOrdinal, + nsSubstring& aResult, + bool& aIsRTL) +{ + switch (mSystem) { + case NS_STYLE_COUNTER_SYSTEM_CYCLIC: + return GetCyclicCounterText(aOrdinal, aResult, GetSymbols()); + case NS_STYLE_COUNTER_SYSTEM_FIXED: { + int32_t start = mRule->GetSystemArgument().GetIntValue(); + return GetFixedCounterText(aOrdinal, aResult, start, GetSymbols()); + } + case NS_STYLE_COUNTER_SYSTEM_SYMBOLIC: + return GetSymbolicCounterText(aOrdinal, aResult, GetSymbols()); + case NS_STYLE_COUNTER_SYSTEM_ALPHABETIC: + return GetAlphabeticCounterText(aOrdinal, aResult, GetSymbols()); + case NS_STYLE_COUNTER_SYSTEM_NUMERIC: + return GetNumericCounterText(aOrdinal, aResult, GetSymbols()); + case NS_STYLE_COUNTER_SYSTEM_ADDITIVE: + return GetAdditiveCounterText(aOrdinal, aResult, GetAdditiveSymbols()); + case NS_STYLE_COUNTER_SYSTEM_EXTENDS: + return GetExtendsRoot()-> + GetInitialCounterText(aOrdinal, aResult, aIsRTL); + default: + NS_NOTREACHED("Invalid system."); + return false; + } +} + +const nsTArray& +CustomCounterStyle::GetSymbols() +{ + if (mSymbols.IsEmpty()) { + const nsCSSValue& values = mRule->GetDesc(eCSSCounterDesc_Symbols); + for (const nsCSSValueList* item = values.GetListValue(); + item; item = item->mNext) { + nsString* symbol = mSymbols.AppendElement(); + item->mValue.GetStringValue(*symbol); + } + mSymbols.Compact(); + } + return mSymbols; +} + +const nsTArray& +CustomCounterStyle::GetAdditiveSymbols() +{ + if (mAdditiveSymbols.IsEmpty()) { + const nsCSSValue& values = mRule->GetDesc(eCSSCounterDesc_AdditiveSymbols); + for (const nsCSSValuePairList* item = values.GetPairListValue(); + item; item = item->mNext) { + AdditiveSymbol* symbol = mAdditiveSymbols.AppendElement(); + symbol->weight = item->mXValue.GetIntValue(); + item->mYValue.GetStringValue(symbol->symbol); + } + mAdditiveSymbols.Compact(); + } + return mAdditiveSymbols; +} + +// This method is used to provide the computed value for 'auto'. +uint8_t +CustomCounterStyle::GetSpeakAsAutoValue() +{ + uint8_t system = mSystem; + if (IsExtendsSystem()) { + CounterStyle* root = GetExtendsRoot(); + if (!root->IsCustomStyle()) { + // It is safe to call GetSpeakAs on non-custom style. + return root->GetSpeakAs(); + } + system = static_cast(root)->mSystem; + } + switch (system) { + case NS_STYLE_COUNTER_SYSTEM_ALPHABETIC: + return NS_STYLE_COUNTER_SPEAKAS_SPELL_OUT; + case NS_STYLE_COUNTER_SYSTEM_CYCLIC: + return NS_STYLE_COUNTER_SPEAKAS_BULLETS; + default: + return NS_STYLE_COUNTER_SPEAKAS_NUMBERS; + } +} + +// This method corresponds to the first stage of computation of the +// value of speak-as. It will extract the value from the rule and +// possibly recursively call itself on the extended style to figure +// out the raw value. To keep things clear, this method is designed to +// have no side effects (but functions it calls may still affect other +// fields in the style.) +void +CustomCounterStyle::ComputeRawSpeakAs(uint8_t& aSpeakAs, + CounterStyle*& aSpeakAsCounter) +{ + NS_ASSERTION(!(mFlags & FLAG_SPEAKAS_INITED), + "ComputeRawSpeakAs is called with speak-as inited."); + + const nsCSSValue& value = mRule->GetDesc(eCSSCounterDesc_SpeakAs); + switch (value.GetUnit()) { + case eCSSUnit_Auto: + aSpeakAs = GetSpeakAsAutoValue(); + break; + case eCSSUnit_Enumerated: + aSpeakAs = value.GetIntValue(); + break; + case eCSSUnit_Ident: + aSpeakAs = NS_STYLE_COUNTER_SPEAKAS_OTHER; + aSpeakAsCounter = mManager->BuildCounterStyle( + nsDependentString(value.GetStringBufferValue())); + break; + case eCSSUnit_Null: { + if (!IsExtendsSystem()) { + aSpeakAs = GetSpeakAsAutoValue(); + } else { + CounterStyle* extended = GetExtends(); + if (!extended->IsCustomStyle()) { + // It is safe to call GetSpeakAs on non-custom style. + aSpeakAs = extended->GetSpeakAs(); + } else { + CustomCounterStyle* custom = + static_cast(extended); + if (!(custom->mFlags & FLAG_SPEAKAS_INITED)) { + custom->ComputeRawSpeakAs(aSpeakAs, aSpeakAsCounter); + } else { + aSpeakAs = custom->mSpeakAs; + aSpeakAsCounter = custom->mSpeakAsCounter; + } + } + } + break; + } + default: + NS_NOTREACHED("Invalid speak-as value"); + } +} + +// This method corresponds to the second stage of getting speak-as +// related values. It will recursively figure out the final value of +// mSpeakAs and mSpeakAsCounter. This method returns nullptr if the +// caller is in a loop, and the root counter style in the chain +// otherwise. It use the same loop detection algorithm as +// CustomCounterStyle::ComputeExtends, see comments before that +// method for more details. +CounterStyle* +CustomCounterStyle::ComputeSpeakAs() +{ + if (mFlags & FLAG_SPEAKAS_INITED) { + if (mSpeakAs == NS_STYLE_COUNTER_SPEAKAS_OTHER) { + return mSpeakAsCounter; + } + return this; + } + + if (mFlags & FLAG_SPEAKAS_VISITED) { + // loop detected + mFlags |= FLAG_SPEAKAS_LOOP; + return nullptr; + } + + CounterStyle* speakAsCounter; + ComputeRawSpeakAs(mSpeakAs, speakAsCounter); + + bool inLoop = false; + if (mSpeakAs != NS_STYLE_COUNTER_SPEAKAS_OTHER) { + mSpeakAsCounter = nullptr; + } else if (!speakAsCounter->IsCustomStyle()) { + mSpeakAsCounter = speakAsCounter; + } else { + mFlags |= FLAG_SPEAKAS_VISITED; + CounterStyle* target = + static_cast(speakAsCounter)->ComputeSpeakAs(); + mFlags &= ~FLAG_SPEAKAS_VISITED; + + if (target) { + NS_ASSERTION(!(mFlags & FLAG_SPEAKAS_LOOP), + "Invalid state for speak-as loop detecting"); + mSpeakAsCounter = target; + } else { + mSpeakAs = GetSpeakAsAutoValue(); + mSpeakAsCounter = nullptr; + if (mFlags & FLAG_SPEAKAS_LOOP) { + mFlags &= ~FLAG_SPEAKAS_LOOP; + } else { + inLoop = true; + } + } + } + + mFlags |= FLAG_SPEAKAS_INITED; + if (inLoop) { + return nullptr; + } + return mSpeakAsCounter ? mSpeakAsCounter : this; +} + +// This method will recursively figure out mExtends in the whole chain. +// It will return nullptr if the caller is in a loop, and return this +// otherwise. To detect the loop, this method marks the style VISITED +// before the recursive call. When a VISITED style is reached again, the +// loop is detected, and flag LOOP will be marked on the first style in +// loop. mExtends of all counter styles in loop will be set to decimal +// according to the spec. +CounterStyle* +CustomCounterStyle::ComputeExtends() +{ + if (!IsExtendsSystem() || mExtends) { + return this; + } + if (mFlags & FLAG_EXTENDS_VISITED) { + // loop detected + mFlags |= FLAG_EXTENDS_LOOP; + return nullptr; + } + + const nsCSSValue& value = mRule->GetSystemArgument(); + CounterStyle* nextCounter = mManager->BuildCounterStyle( + nsDependentString(value.GetStringBufferValue())); + CounterStyle* target = nextCounter; + if (nextCounter->IsCustomStyle()) { + mFlags |= FLAG_EXTENDS_VISITED; + target = static_cast(nextCounter)->ComputeExtends(); + mFlags &= ~FLAG_EXTENDS_VISITED; + } + + if (target) { + NS_ASSERTION(!(mFlags & FLAG_EXTENDS_LOOP), + "Invalid state for extends loop detecting"); + mExtends = nextCounter; + return this; + } else { + mExtends = CounterStyleManager::GetDecimalStyle(); + if (mFlags & FLAG_EXTENDS_LOOP) { + mFlags &= ~FLAG_EXTENDS_LOOP; + return this; + } else { + return nullptr; + } + } +} + +CounterStyle* +CustomCounterStyle::GetExtends() +{ + if (!mExtends) { + // Any extends loop will be eliminated in the method below. + ComputeExtends(); + } + return mExtends; +} + +CounterStyle* +CustomCounterStyle::GetExtendsRoot() +{ + if (!mExtendsRoot) { + CounterStyle* extended = GetExtends(); + mExtendsRoot = extended; + if (extended->IsCustomStyle()) { + CustomCounterStyle* custom = static_cast(extended); + if (custom->IsExtendsSystem()) { + // This will make mExtendsRoot in the whole extends chain be + // set recursively, which could save work when part of a chain + // is shared by multiple counter styles. + mExtendsRoot = custom->GetExtendsRoot(); + } + } + } + return mExtendsRoot; +} + +bool +CounterStyle::IsDependentStyle() const +{ + switch (mStyle) { + // CustomCounterStyle + case NS_STYLE_LIST_STYLE_CUSTOM: + // DependentBuiltinCounterStyle + case NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL: + case NS_STYLE_LIST_STYLE_JAPANESE_FORMAL: + case NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL: + case NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL: + case NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL: + case NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL: + case NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL: + case NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL: + case NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL: + return true; + + // BuiltinCounterStyle + default: + return false; + } +} + +static int32_t +CountGraphemeClusters(const nsSubstring& aText) +{ + using mozilla::unicode::ClusterIterator; + ClusterIterator iter(aText.Data(), aText.Length()); + int32_t result = 0; + while (!iter.AtEnd()) { + ++result; + iter.Next(); + } + return result; +} + +void +CounterStyle::GetCounterText(CounterValue aOrdinal, + nsSubstring& aResult, + bool& aIsRTL) +{ + bool success = IsOrdinalInRange(aOrdinal); + aIsRTL = false; + + if (success) { + // generate initial representation + bool useNegativeSign = UseNegativeSign(); + nsAutoString initialText; + CounterValue ordinal; + if (!useNegativeSign) { + ordinal = aOrdinal; + } else { + CheckedInt absolute(Abs(aOrdinal)); + ordinal = absolute.isValid() ? + absolute.value() : std::numeric_limits::max(); + } + success = GetInitialCounterText(ordinal, initialText, aIsRTL); + + // add pad & negative, build the final result + if (success) { + PadType pad; + GetPad(pad); + // We have to calculate the difference here since suffix part of negative + // sign may be appended to initialText later. + int32_t diff = pad.width - CountGraphemeClusters(initialText); + aResult.Truncate(); + if (useNegativeSign && aOrdinal < 0) { + NegativeType negative; + GetNegative(negative); + aResult.Append(negative.before); + // There is nothing between the suffix part of negative and initial + // representation, so we append it directly here. + initialText.Append(negative.after); + } + if (diff > 0) { + auto length = pad.symbol.Length(); + if (diff > LENGTH_LIMIT || length > LENGTH_LIMIT || + diff * length > LENGTH_LIMIT) { + success = false; + } else if (length > 0) { + for (int32_t i = 0; i < diff; ++i) { + aResult.Append(pad.symbol); + } + } + } + if (success) { + aResult.Append(initialText); + } + } + } + + if (!success) { + CallFallbackStyle(aOrdinal, aResult, aIsRTL); + } +} + +/* virtual */ void +CounterStyle::GetSpokenCounterText(CounterValue aOrdinal, + nsSubstring& aResult, + bool& aIsBullet) +{ + bool isRTL; // we don't care about direction for spoken text + aIsBullet = false; + switch (GetSpeakAs()) { + case NS_STYLE_COUNTER_SPEAKAS_BULLETS: + aResult.Assign(kDiscCharacter); + aIsBullet = true; + break; + case NS_STYLE_COUNTER_SPEAKAS_NUMBERS: + // use decimal to generate numeric text + // XXX change to DecimalToText after moving it here + CounterStyleManager::GetDecimalStyle()-> + GetCounterText(aOrdinal, aResult, isRTL); + break; + case NS_STYLE_COUNTER_SPEAKAS_SPELL_OUT: + // we currently do not actually support 'spell-out', + // so 'words' is used instead. + case NS_STYLE_COUNTER_SPEAKAS_WORDS: + GetCounterText(aOrdinal, aResult, isRTL); + break; + case NS_STYLE_COUNTER_SPEAKAS_OTHER: + // This should be processed by CustomCounterStyle + NS_NOTREACHED("Invalid speak-as value"); + break; + default: + NS_NOTREACHED("Unknown speak-as value"); + break; + } +} + +static BuiltinCounterStyle gBuiltinStyleTable[NS_STYLE_LIST_STYLE__MAX]; + +CounterStyleManager::CounterStyleManager(nsPresContext* aPresContext) + : mPresContext(aPresContext) +{ + // Insert the static styles into cache table + mCacheTable.Put(NS_LITERAL_STRING("none"), GetNoneStyle()); + mCacheTable.Put(NS_LITERAL_STRING("decimal"), GetDecimalStyle()); +} + +CounterStyleManager::~CounterStyleManager() +{ + NS_ABORT_IF_FALSE(!mPresContext, "Disconnect should have been called"); +} + +/* static */ void +CounterStyleManager::InitializeBuiltinCounterStyles() +{ + for (uint32_t i = 0; i < NS_STYLE_LIST_STYLE__MAX; ++i) { + gBuiltinStyleTable[i].mStyle = i; + } +} + +#ifdef DEBUG +static PLDHashOperator +CheckRefCount(const nsSubstring& aKey, + CounterStyle* aStyle, + void* aArg) +{ + aStyle->AddRef(); + auto refcnt = aStyle->Release(); + NS_ASSERTION(!aStyle->IsDependentStyle() || refcnt == 1, + "Counter style is still referenced by other objects."); + return PL_DHASH_NEXT; +} +#endif + +void +CounterStyleManager::Disconnect() +{ +#ifdef DEBUG + mCacheTable.EnumerateRead(CheckRefCount, nullptr); +#endif + mCacheTable.Clear(); + mPresContext = nullptr; +} + +CounterStyle* +CounterStyleManager::BuildCounterStyle(const nsSubstring& aName) +{ + CounterStyle* data = mCacheTable.GetWeak(aName); + if (data) { + return data; + } + + // It is intentional that the predefined names are case-insensitive + // but the user-defined names case-sensitive. + nsCSSCounterStyleRule* rule = + mPresContext->StyleSet()->CounterStyleRuleForName(mPresContext, aName); + if (rule) { + data = new CustomCounterStyle(this, rule); + } else { + int32_t type; + nsCSSKeyword keyword = nsCSSKeywords::LookupKeyword(aName); + if (nsCSSProps::FindKeyword(keyword, nsCSSProps::kListStyleKTable, type)) { + if (gBuiltinStyleTable[type].IsDependentStyle()) { + data = new DependentBuiltinCounterStyle(type, this); + } else { + data = GetBuiltinStyle(type); + } + } + } + if (!data) { + data = GetDecimalStyle(); + } + mCacheTable.Put(aName, data); + return data; +} + +/* static */ CounterStyle* +CounterStyleManager::GetBuiltinStyle(int32_t aStyle) +{ + NS_ABORT_IF_FALSE(0 <= aStyle && aStyle < NS_STYLE_LIST_STYLE__MAX, + "Require a valid builtin style constant"); + NS_ABORT_IF_FALSE(!gBuiltinStyleTable[aStyle].IsDependentStyle(), + "Cannot get dependent builtin style"); + return &gBuiltinStyleTable[aStyle]; +} + +struct InvalidateOldStyleData +{ + explicit InvalidateOldStyleData(nsPresContext* aPresContext) + : mPresContext(aPresContext), + mChanged(false) + { + } + + nsPresContext* mPresContext; + nsTArray> mToBeRemoved; + bool mChanged; +}; + +static PLDHashOperator +InvalidateOldStyle(const nsSubstring& aKey, + nsRefPtr& aStyle, + void* aArg) +{ + InvalidateOldStyleData* data = static_cast(aArg); + bool toBeUpdated = false; + bool toBeRemoved = false; + nsCSSCounterStyleRule* newRule = data->mPresContext-> + StyleSet()->CounterStyleRuleForName(data->mPresContext, aKey); + if (!newRule) { + if (aStyle->IsCustomStyle()) { + toBeRemoved = true; + } + } else { + if (!aStyle->IsCustomStyle()) { + toBeRemoved = true; + } else { + CustomCounterStyle* style = + static_cast(aStyle.get()); + if (style->GetRule() != newRule) { + toBeRemoved = true; + } else if (style->GetRuleGeneration() != newRule->GetGeneration()) { + toBeUpdated = true; + style->ResetCachedData(); + } + } + } + data->mChanged = data->mChanged || toBeUpdated || toBeRemoved; + if (toBeRemoved) { + if (aStyle->IsDependentStyle()) { + // The object has to be held here so that it will not be released + // before all pointers that refer to it are reset. It will be + // released when the MarkAndCleanData goes out of scope at the end + // of NotifyRuleChanged(). + data->mToBeRemoved.AppendElement(aStyle); + } + return PL_DHASH_REMOVE; + } + return PL_DHASH_NEXT; +} + +static PLDHashOperator +InvalidateDependentData(const nsSubstring& aKey, + CounterStyle* aStyle, + void* aArg) +{ + if (aStyle->IsCustomStyle()) { + CustomCounterStyle* custom = static_cast(aStyle); + custom->ResetDependentData(); + } + // There is no dependent data cached in DependentBuiltinCounterStyle + // instances, so we don't need to reset their data. + return PL_DHASH_NEXT; +} + +bool +CounterStyleManager::NotifyRuleChanged() +{ + InvalidateOldStyleData data(mPresContext); + mCacheTable.Enumerate(InvalidateOldStyle, &data); + if (data.mChanged) { + mCacheTable.EnumerateRead(InvalidateDependentData, nullptr); + } + return data.mChanged; +} + +} // namespace mozilla diff --git a/layout/style/CounterStyleManager.h b/layout/style/CounterStyleManager.h new file mode 100644 index 00000000000..eb0903182a8 --- /dev/null +++ b/layout/style/CounterStyleManager.h @@ -0,0 +1,139 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#ifndef mozilla_CounterStyleManager_h_ +#define mozilla_CounterStyleManager_h_ + +#include "nsStringFwd.h" +#include "nsRefPtrHashtable.h" +#include "nsHashKeys.h" + +#include "nsStyleConsts.h" + +#include "mozilla/NullPtr.h" +#include "mozilla/Attributes.h" + +class nsPresContext; +class nsCSSCounterStyleRule; + +namespace mozilla { + +typedef int32_t CounterValue; + +class CounterStyleManager; + +struct NegativeType; +struct PadType; + +class CounterStyle +{ +protected: + explicit MOZ_CONSTEXPR CounterStyle(int32_t aStyle) + : mStyle(aStyle) + { + } + +private: + CounterStyle(const CounterStyle& aOther) MOZ_DELETE; + void operator=(const CounterStyle& other) MOZ_DELETE; + +public: + int32_t GetStyle() const { return mStyle; } + bool IsNone() const { return mStyle == NS_STYLE_LIST_STYLE_NONE; } + bool IsCustomStyle() const { return mStyle == NS_STYLE_LIST_STYLE_CUSTOM; } + // A style is dependent if it depends on the counter style manager. + // Custom styles are certainly dependent. In addition, some builtin + // styles are dependent for fallback. + bool IsDependentStyle() const; + + virtual void GetPrefix(nsSubstring& aResult) = 0; + virtual void GetSuffix(nsSubstring& aResult) = 0; + void GetCounterText(CounterValue aOrdinal, + nsSubstring& aResult, + bool& aIsRTL); + virtual void GetSpokenCounterText(CounterValue aOrdinal, + nsSubstring& aResult, + bool& aIsBullet); + + // XXX This method could be removed once ::-moz-list-bullet and + // ::-moz-list-number are completely merged into ::marker. + virtual bool IsBullet() = 0; + + virtual void GetNegative(NegativeType& aResult) = 0; + /** + * This method returns whether an ordinal is in the range of this + * counter style. Note that, it is possible that an ordinal in range + * is rejected by the generating algorithm. + */ + virtual bool IsOrdinalInRange(CounterValue aOrdinal) = 0; + /** + * This method returns whether an ordinal is in the default range of + * this counter style. This is the effective range when no 'range' + * descriptor is specified. + */ + virtual bool IsOrdinalInAutoRange(CounterValue aOrdinal) = 0; + virtual void GetPad(PadType& aResult) = 0; + virtual CounterStyle* GetFallback() = 0; + virtual uint8_t GetSpeakAs() = 0; + virtual bool UseNegativeSign() = 0; + + virtual void CallFallbackStyle(CounterValue aOrdinal, + nsSubstring& aResult, + bool& aIsRTL) = 0; + virtual bool GetInitialCounterText(CounterValue aOrdinal, + nsSubstring& aResult, + bool& aIsRTL) = 0; + + NS_IMETHOD_(MozExternalRefCountType) AddRef() = 0; + NS_IMETHOD_(MozExternalRefCountType) Release() = 0; + +protected: + int32_t mStyle; +}; + +class CounterStyleManager MOZ_FINAL +{ +public: + CounterStyleManager(nsPresContext* aPresContext); + ~CounterStyleManager(); + + static void InitializeBuiltinCounterStyles(); + + void Disconnect(); + + bool IsInitial() const + { + // only 'none' and 'decimal' + return mCacheTable.Count() == 2; + } + + CounterStyle* BuildCounterStyle(const nsSubstring& aName); + + static CounterStyle* GetBuiltinStyle(int32_t aStyle); + static CounterStyle* GetNoneStyle() + { + return GetBuiltinStyle(NS_STYLE_LIST_STYLE_NONE); + } + static CounterStyle* GetDecimalStyle() + { + return GetBuiltinStyle(NS_STYLE_LIST_STYLE_DECIMAL); + } + + // This method will scan all existing counter styles generated by this + // manager, and remove or mark data dirty accordingly. It returns true + // if any counter style is changed, false elsewise. This method should + // be called when any counter style may be affected. + bool NotifyRuleChanged(); + + NS_INLINE_DECL_REFCOUNTING(CounterStyleManager) + +private: + nsPresContext* mPresContext; + nsRefPtrHashtable mCacheTable; +}; + +} // namespace mozilla + +#endif /* !defined(mozilla_CounterStyleManager_h_) */ diff --git a/layout/style/moz.build b/layout/style/moz.build index 447c4750433..7af7d1690e4 100644 --- a/layout/style/moz.build +++ b/layout/style/moz.build @@ -84,6 +84,7 @@ EXPORTS.mozilla.css += [ UNIFIED_SOURCES += [ 'AnimationCommon.cpp', + 'CounterStyleManager.cpp', 'CSS.cpp', 'CSSRuleList.cpp', 'CSSVariableDeclarations.cpp', diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h index da9e03ec480..e68cd1f386e 100644 --- a/layout/style/nsStyleConsts.h +++ b/layout/style/nsStyleConsts.h @@ -634,6 +634,7 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) { #define NS_STYLE_OVERFLOW_CLIP_BOX_CONTENT_BOX 1 // See nsStyleList +#define NS_STYLE_LIST_STYLE_CUSTOM -1 // for @counter-style #define NS_STYLE_LIST_STYLE_NONE 0 #define NS_STYLE_LIST_STYLE_DISC 1 #define NS_STYLE_LIST_STYLE_CIRCLE 2 @@ -696,6 +697,7 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) { #define NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_AM 152 #define NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ER 153 #define NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ET 154 +#define NS_STYLE_LIST_STYLE__MAX 155 // See nsStyleList #define NS_STYLE_LIST_STYLE_POSITION_INSIDE 0 @@ -1072,6 +1074,7 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) { #define NS_STYLE_COUNTER_SPEAKAS_NUMBERS 1 #define NS_STYLE_COUNTER_SPEAKAS_WORDS 2 #define NS_STYLE_COUNTER_SPEAKAS_SPELL_OUT 3 +#define NS_STYLE_COUNTER_SPEAKAS_OTHER 255 // refer to another style /***************************************************************************** * Constants for media features. * From 837f68f5fc1d8c8d9058abeb170d1f1b7b42305a Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 11 Jun 2014 21:12:00 -0400 Subject: [PATCH 08/68] Bug 966166 - Part 3: Link to other parts. r=dbaron --- accessible/src/html/HTMLListAccessible.cpp | 4 +- layout/base/nsCSSFrameConstructor.cpp | 11 +- layout/base/nsCSSFrameConstructor.h | 3 + layout/base/nsCounterManager.cpp | 51 ++++- layout/base/nsCounterManager.h | 22 ++- layout/base/nsIPresShell.h | 2 + layout/base/nsPresContext.cpp | 43 ++++ layout/base/nsPresContext.h | 15 +- layout/base/nsPresShell.cpp | 14 ++ layout/base/nsPresShell.h | 1 + layout/generic/nsBlockFrame.cpp | 42 ++-- layout/generic/nsBlockFrame.h | 2 +- layout/generic/nsBulletFrame.cpp | 185 +++++------------- layout/generic/nsBulletFrame.h | 4 +- layout/generic/nsHTMLReflowState.cpp | 24 ++- .../counter-reset-integer-range-ref.html | 4 +- .../counters/counter-ua-limits-02-ref.html | 4 +- layout/reftests/counters/reftest.list | 4 +- .../counters/t1202-counter-16-f-test.html | 1 - .../counters/t1202-counters-18-f-test.html | 1 - layout/style/Declaration.cpp | 10 +- layout/style/moz.build | 1 + layout/style/nsCSSParser.cpp | 58 +++--- layout/style/nsCSSPropList.h | 7 +- layout/style/nsComputedDOMStyle.cpp | 20 +- layout/style/nsRuleNode.cpp | 45 ++++- layout/style/nsStyleStruct.cpp | 14 +- layout/style/nsStyleStruct.h | 24 ++- layout/style/test/property_database.js | 7 +- .../test_garbage_at_end_of_declarations.html | 7 + 30 files changed, 369 insertions(+), 261 deletions(-) diff --git a/accessible/src/html/HTMLListAccessible.cpp b/accessible/src/html/HTMLListAccessible.cpp index f879956d440..b1f214cdf09 100644 --- a/accessible/src/html/HTMLListAccessible.cpp +++ b/accessible/src/html/HTMLListAccessible.cpp @@ -165,7 +165,7 @@ HTMLListBulletAccessible::Name(nsString &aName) // Native anonymous content, ARIA can't be used. Get list bullet text. nsBlockFrame* blockFrame = do_QueryFrame(mContent->GetPrimaryFrame()); if (blockFrame) { - blockFrame->GetBulletText(aName); + blockFrame->GetSpokenBulletText(aName); } return eNameOK; @@ -190,7 +190,7 @@ HTMLListBulletAccessible::AppendTextTo(nsAString& aText, uint32_t aStartOffset, nsAutoString bulletText; nsBlockFrame* blockFrame = do_QueryFrame(mContent->GetPrimaryFrame()); if (blockFrame) - blockFrame->GetBulletText(bulletText); + blockFrame->GetSpokenBulletText(bulletText); aText.Append(Substring(bulletText, aStartOffset, aLength)); } diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 83ac10fe923..085408a128b 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -1674,7 +1674,8 @@ nsCSSFrameConstructor::CreateGeneratedContent(nsFrameConstructorState& aState, return nullptr; nsCounterUseNode* node = - new nsCounterUseNode(counters, aContentIndex, + new nsCounterUseNode(mPresShell->GetPresContext(), + counters, aContentIndex, type == eStyleContentType_Counters); nsGenConInitializer* initializer = @@ -8008,6 +8009,14 @@ nsCSSFrameConstructor::RecalcQuotesAndCounters() NS_ASSERTION(!mCountersDirty, "Counter updates will be lost"); } +void +nsCSSFrameConstructor::NotifyCounterStylesAreDirty() +{ + NS_PRECONDITION(mUpdateCount != 0, "Should be in an update"); + mCounterManager.SetAllCounterStylesDirty(); + CountersDirty(); +} + void nsCSSFrameConstructor::WillDestroyFrameTree() { diff --git a/layout/base/nsCSSFrameConstructor.h b/layout/base/nsCSSFrameConstructor.h index cd0bb7c26ec..57370f7d50b 100644 --- a/layout/base/nsCSSFrameConstructor.h +++ b/layout/base/nsCSSFrameConstructor.h @@ -220,6 +220,9 @@ public: void EndUpdate(); void RecalcQuotesAndCounters(); + // Called when any counter style is changed. + void NotifyCounterStylesAreDirty(); + // Gets called when the presshell is destroying itself and also // when we tear down our frame tree to reconstruct it void WillDestroyFrameTree(); diff --git a/layout/base/nsCounterManager.cpp b/layout/base/nsCounterManager.cpp index b05953a3a2f..0bdca1eff05 100644 --- a/layout/base/nsCounterManager.cpp +++ b/layout/base/nsCounterManager.cpp @@ -13,6 +13,8 @@ #include "mozilla/Likely.h" #include "nsIContent.h" +using namespace mozilla; + bool nsCounterUseNode::InitTextFrame(nsGenConList* aList, nsIFrame* aPseudoFrame, nsIFrame* aTextFrame) @@ -40,6 +42,17 @@ nsCounterUseNode::InitTextFrame(nsGenConList* aList, return false; } +CounterStyle* +nsCounterUseNode::GetCounterStyle() +{ + if (!mCounterStyle) { + const nsCSSValue& style = mCounterFunction->Item(mAllCounters ? 2 : 1); + mCounterStyle = mPresContext->CounterStyleManager()-> + BuildCounterStyle(nsDependentString(style.GetStringBufferValue())); + } + return mCounterStyle; +} + // assign the correct |mValueAfter| value to a node that has been inserted // Should be called immediately after calling |Insert|. void nsCounterUseNode::Calc(nsCounterList *aList) @@ -77,17 +90,17 @@ nsCounterUseNode::GetText(nsString& aResult) for (nsCounterNode *n = mScopeStart; n->mScopePrev; n = n->mScopeStart) stack.AppendElement(n->mScopePrev); - const nsCSSValue& styleItem = mCounterStyle->Item(mAllCounters ? 2 : 1); - int32_t style = styleItem.GetIntValue(); const char16_t* separator; if (mAllCounters) - separator = mCounterStyle->Item(1).GetStringBufferValue(); + separator = mCounterFunction->Item(1).GetStringBufferValue(); + CounterStyle* style = GetCounterStyle(); for (uint32_t i = stack.Length() - 1;; --i) { nsCounterNode *n = stack[i]; + nsAutoString text; bool isTextRTL; - nsBulletFrame::AppendCounterText( - style, n->mValueAfter, aResult, isTextRTL); + style->GetCounterText(n->mValueAfter, text, isTextRTL); + aResult.Append(text); if (i == 0) break; NS_ASSERTION(mAllCounters, "yikes, separator is uninitialized"); @@ -267,6 +280,34 @@ nsCounterManager::RecalcAll() mNames.EnumerateRead(RecalcDirtyLists, nullptr); } +static PLDHashOperator +SetCounterStylesDirty(const nsAString& aKey, + nsCounterList* aList, + void* aClosure) +{ + nsCounterNode* first = aList->First(); + if (first) { + bool changed = false; + nsCounterNode* node = first; + do { + if (node->mType == nsCounterNode::USE) { + node->UseNode()->SetCounterStyleDirty(); + changed = true; + } + } while ((node = aList->Next(node)) != first); + if (changed) { + aList->SetDirty(); + } + } + return PL_DHASH_NEXT; +} + +void +nsCounterManager::SetAllCounterStylesDirty() +{ + mNames.EnumerateRead(SetCounterStylesDirty, nullptr); +} + struct DestroyNodesData { DestroyNodesData(nsIFrame *aFrame) : mFrame(aFrame) diff --git a/layout/base/nsCounterManager.h b/layout/base/nsCounterManager.h index 93452bc969e..87c7341035c 100644 --- a/layout/base/nsCounterManager.h +++ b/layout/base/nsCounterManager.h @@ -14,6 +14,7 @@ #include "nsAutoPtr.h" #include "nsClassHashtable.h" #include "mozilla/Likely.h" +#include "CounterStyleManager.h" class nsCounterList; struct nsCounterUseNode; @@ -79,16 +80,22 @@ struct nsCounterUseNode : public nsCounterNode { // The same structure passed through the style system: an array // containing the values in the counter() or counters() in the order // given in the CSS spec. - nsRefPtr mCounterStyle; + nsRefPtr mCounterFunction; + + nsPresContext* mPresContext; + nsRefPtr mCounterStyle; // false for counter(), true for counters() bool mAllCounters; // args go directly to member variables here and of nsGenConNode - nsCounterUseNode(nsCSSValue::Array* aCounterStyle, + nsCounterUseNode(nsPresContext* aPresContext, + nsCSSValue::Array* aCounterFunction, uint32_t aContentIndex, bool aAllCounters) : nsCounterNode(aContentIndex, USE) - , mCounterStyle(aCounterStyle) + , mCounterFunction(aCounterFunction) + , mPresContext(aPresContext) + , mCounterStyle(nullptr) , mAllCounters(aAllCounters) { NS_ASSERTION(aContentIndex <= INT32_MAX, "out of range"); @@ -97,6 +104,12 @@ struct nsCounterUseNode : public nsCounterNode { virtual bool InitTextFrame(nsGenConList* aList, nsIFrame* aPseudoFrame, nsIFrame* aTextFrame) MOZ_OVERRIDE; + mozilla::CounterStyle* GetCounterStyle(); + void SetCounterStyleDirty() + { + mCounterStyle = nullptr; + } + // assign the correct |mValueAfter| value to a node that has been inserted // Should be called immediately after calling |Insert|. void Calc(nsCounterList* aList); @@ -219,6 +232,9 @@ public: // Clean up data in any dirty counter lists. void RecalcAll(); + // Set all counter styles dirty + void SetAllCounterStylesDirty(); + // Destroy nodes for the frame in any lists, and return whether any // nodes were destroyed. bool DestroyNodesFor(nsIFrame *aFrame); diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index 7b9595dbdfd..49cf4d698e8 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -530,6 +530,8 @@ public: virtual void CancelAllPendingReflows() = 0; + virtual void NotifyCounterStylesAreDirty() = 0; + /** * Recreates the frames for a node */ diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 9b1bc08fa02..759972d7a4a 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -240,6 +240,8 @@ nsPresContext::nsPresContext(nsIDocument* aDocument, nsPresContextType aType) mUserFontSet = nullptr; mUserFontSetDirty = true; + mCounterStylesDirty = true; + // if text perf logging enabled, init stats struct PRLogModuleInfo *log = gfxPlatform::GetLog(eGfxLog_textperf); if (log && log->level >= PR_LOG_WARNING) { @@ -1875,6 +1877,7 @@ nsPresContext::RebuildAllStyleData(nsChangeHint aExtraHint) mUsesRootEMUnits = false; mUsesViewportUnits = false; RebuildUserFontSet(); + RebuildCounterStyles(); RestyleManager()->RebuildAllStyleData(aExtraHint); } @@ -2209,6 +2212,46 @@ nsPresContext::UserFontSetUpdated() PostRebuildAllStyleDataEvent(NS_STYLE_HINT_REFLOW); } +void +nsPresContext::FlushCounterStyles() +{ + if (!mShell) { + return; // we've been torn down + } + if (mCounterStyleManager->IsInitial()) { + // Still in its initial state, no need to clean. + return; + } + + if (mCounterStylesDirty) { + bool changed = mCounterStyleManager->NotifyRuleChanged(); + if (changed) { + PresShell()->NotifyCounterStylesAreDirty(); + PostRebuildAllStyleDataEvent(NS_STYLE_HINT_REFLOW); + } + mCounterStylesDirty = false; + } +} + +void +nsPresContext::RebuildCounterStyles() +{ + if (mCounterStyleManager->IsInitial()) { + // Still in its initial state, no need to reset. + return; + } + + mCounterStylesDirty = true; + mDocument->SetNeedStyleFlush(); + if (!mPostedFlushCounterStyles) { + nsCOMPtr ev = + NS_NewRunnableMethod(this, &nsPresContext::HandleRebuildCounterStyles); + if (NS_SUCCEEDED(NS_DispatchToCurrentThread(ev))) { + mPostedFlushCounterStyles = true; + } + } +} + void nsPresContext::EnsureSafeToHandOutCSSRules() { diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 97de0cac8f6..036b15627a6 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -253,7 +253,7 @@ public: * Rebuilds all style data by throwing out the old rule tree and * building a new one, and additionally applying aExtraHint (which * must not contain nsChangeHint_ReconstructFrame) to the root frame. - * Also rebuild the user font set. + * Also rebuild the user font set and counter style manager. */ void RebuildAllStyleData(nsChangeHint aExtraHint); /** @@ -874,6 +874,9 @@ public: // user font set is changed and fonts become unavailable). void UserFontSetUpdated(); + void FlushCounterStyles(); + void RebuildCounterStyles(); // asynchronously + // Ensure that it is safe to hand out CSS rules outside the layout // engine by ensuring that all CSS style sheets have unique inners // and, if necessary, synchronously rebuilding all style data. @@ -1163,6 +1166,11 @@ protected: FlushUserFontSet(); } + void HandleRebuildCounterStyles() { + mPostedFlushCounterStyles = false; + FlushCounterStyles(); + } + bool HavePendingInputEvent(); // Can't be inline because we can't include nsStyleSet.h. @@ -1328,6 +1336,11 @@ protected: // Do we currently have an event posted to call FlushUserFontSet? unsigned mPostedFlushUserFontSet : 1; + // Is the current mCounterStyleManager valid? + unsigned mCounterStylesDirty : 1; + // Do we currently have an event posted to call FlushCounterStyles? + unsigned mPostedFlushCounterStyles: 1; + // resize reflow is suppressed when the only change has been to zoom // the document rather than to change the document's dimensions unsigned mSupressResizeReflow : 1; diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 3a1178b8e1e..54fef646acf 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -4171,6 +4171,8 @@ PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush) // reflow). mPresContext->FlushUserFontSet(); + mPresContext->FlushCounterStyles(); + // Flush any requested SMIL samples. if (mDocument->HasAnimationController()) { mDocument->GetAnimationController()->FlushResampleRequests(); @@ -4517,6 +4519,15 @@ PresShell::ContentRemoved(nsIDocument *aDocument, VERIFY_STYLE_TREE; } +void +PresShell::NotifyCounterStylesAreDirty() +{ + nsAutoCauseReflowNotifier reflowNotifier(this); + mFrameConstructor->BeginUpdate(); + mFrameConstructor->NotifyCounterStylesAreDirty(); + mFrameConstructor->EndUpdate(); +} + nsresult PresShell::ReconstructFrames(void) { @@ -4563,6 +4574,7 @@ nsIPresShell::ReconstructStyleDataInternal() if (mPresContext) { mPresContext->RebuildUserFontSet(); + mPresContext->RebuildCounterStyles(); } Element* root = mDocument->GetRootElement(); @@ -8556,6 +8568,8 @@ PresShell::WillDoReflow() mPresContext->FlushUserFontSet(); + mPresContext->FlushCounterStyles(); + mFrameConstructor->BeginUpdate(); mLastReflowStart = GetPerformanceNow(); diff --git a/layout/base/nsPresShell.h b/layout/base/nsPresShell.h index 87530426674..ed73de136b4 100644 --- a/layout/base/nsPresShell.h +++ b/layout/base/nsPresShell.h @@ -159,6 +159,7 @@ public: virtual already_AddRefed GetEventTargetContent( mozilla::WidgetEvent* aEvent) MOZ_OVERRIDE; + virtual void NotifyCounterStylesAreDirty(); virtual nsresult ReconstructFrames(void) MOZ_OVERRIDE; virtual void Freeze() MOZ_OVERRIDE; diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 9e60da88541..19462f46bc6 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -48,6 +48,7 @@ #include "nsRenderingContext.h" #include "TextOverflow.h" #include "nsIFrameInlines.h" +#include "CounterStyleManager.h" #include "nsBidiPresUtils.h" @@ -6486,17 +6487,10 @@ nsBlockFrame::SetInitialChildList(ChildListID aListID, !GetPrevInFlow()) { // Resolve style for the bullet frame const nsStyleList* styleList = StyleList(); - nsCSSPseudoElements::Type pseudoType; - switch (styleList->mListStyleType) { - case NS_STYLE_LIST_STYLE_DISC: - case NS_STYLE_LIST_STYLE_CIRCLE: - case NS_STYLE_LIST_STYLE_SQUARE: - pseudoType = nsCSSPseudoElements::ePseudo_mozListBullet; - break; - default: - pseudoType = nsCSSPseudoElements::ePseudo_mozListNumber; - break; - } + CounterStyle* style = styleList->GetCounterStyle(); + nsCSSPseudoElements::Type pseudoType = style->IsBullet() ? + nsCSSPseudoElements::ePseudo_mozListBullet : + nsCSSPseudoElements::ePseudo_mozListNumber; nsIPresShell *shell = presContext->PresShell(); @@ -6535,35 +6529,23 @@ nsBlockFrame::BulletIsEmpty() const NS_STYLE_DISPLAY_LIST_ITEM && HasOutsideBullet(), "should only care when we have an outside bullet"); const nsStyleList* list = StyleList(); - return list->mListStyleType == NS_STYLE_LIST_STYLE_NONE && + return list->GetCounterStyle()->IsNone() && !list->GetListStyleImage(); } void -nsBlockFrame::GetBulletText(nsAString& aText) const +nsBlockFrame::GetSpokenBulletText(nsAString& aText) const { - aText.Truncate(); - const nsStyleList* myList = StyleList(); - if (myList->GetListStyleImage() || - myList->mListStyleType == NS_STYLE_LIST_STYLE_DISC) { + if (myList->GetListStyleImage()) { aText.Assign(kDiscCharacter); aText.Append(' '); - } - else if (myList->mListStyleType == NS_STYLE_LIST_STYLE_CIRCLE) { - aText.Assign(kCircleCharacter); - aText.Append(' '); - } - else if (myList->mListStyleType == NS_STYLE_LIST_STYLE_SQUARE) { - aText.Assign(kSquareCharacter); - aText.Append(' '); - } - else if (myList->mListStyleType != NS_STYLE_LIST_STYLE_NONE) { + } else { nsBulletFrame* bullet = GetBullet(); if (bullet) { - nsAutoString text; - bullet->GetListItemText(*myList, text); - aText = text; + bullet->GetSpokenText(aText); + } else { + aText.Truncate(); } } } diff --git a/layout/generic/nsBlockFrame.h b/layout/generic/nsBlockFrame.h index bae964fc081..00480c8478a 100644 --- a/layout/generic/nsBlockFrame.h +++ b/layout/generic/nsBlockFrame.h @@ -193,7 +193,7 @@ public: /** * Return the bullet text equivalent. */ - void GetBulletText(nsAString& aText) const; + void GetSpokenBulletText(nsAString& aText) const; /** * Return true if there's a bullet. diff --git a/layout/generic/nsBulletFrame.cpp b/layout/generic/nsBulletFrame.cpp index c348cbd0988..aaab13e37eb 100644 --- a/layout/generic/nsBulletFrame.cpp +++ b/layout/generic/nsBulletFrame.cpp @@ -20,6 +20,7 @@ #include "nsDisplayList.h" #include "nsCounterManager.h" #include "nsBidiUtils.h" +#include "CounterStyleManager.h" #include "imgIContainer.h" #include "imgRequestProxy.h" @@ -91,7 +92,7 @@ nsBulletFrame::IsEmpty() bool nsBulletFrame::IsSelfEmpty() { - return StyleList()->mListStyleType == NS_STYLE_LIST_STYLE_NONE; + return StyleList()->GetCounterStyle()->IsNone(); } /* virtual */ void @@ -166,11 +167,11 @@ nsBulletFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext) const nsStyleList* oldStyleList = aOldStyleContext->PeekStyleList(); if (oldStyleList) { bool hadBullet = oldStyleList->GetListStyleImage() || - oldStyleList->mListStyleType != NS_STYLE_LIST_STYLE_NONE; + !oldStyleList->GetCounterStyle()->IsNone(); const nsStyleList* newStyleList = StyleList(); bool hasBullet = newStyleList->GetListStyleImage() || - newStyleList->mListStyleType != NS_STYLE_LIST_STYLE_NONE; + !newStyleList->GetCounterStyle()->IsNone(); if (hadBullet != hasBullet) { accService->UpdateListBullet(PresContext()->GetPresShell(), mContent, @@ -289,7 +290,7 @@ nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt, const nsRect& aDirtyRect, uint32_t aFlags) { const nsStyleList* myList = StyleList(); - uint8_t listStyleType = myList->mListStyleType; + CounterStyle* listStyleType = myList->GetCounterStyle(); if (myList->GetListStyleImage() && mImageRequest) { uint32_t status; @@ -314,11 +315,10 @@ nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt, aRenderingContext.SetColor(nsLayoutUtils::GetColor(this, eCSSProperty_color)); nsAutoString text; - switch (listStyleType) { + switch (listStyleType->GetStyle()) { case NS_STYLE_LIST_STYLE_NONE: break; - default: case NS_STYLE_LIST_STYLE_DISC: aRenderingContext.FillEllipse(mPadding.left + aPt.x, mPadding.top + aPt.y, mRect.width - (mPadding.left + mPadding.right), @@ -353,65 +353,10 @@ nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt, } break; - case NS_STYLE_LIST_STYLE_DECIMAL: - case NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO: - case NS_STYLE_LIST_STYLE_CJK_DECIMAL: - case NS_STYLE_LIST_STYLE_LOWER_ROMAN: - case NS_STYLE_LIST_STYLE_UPPER_ROMAN: - case NS_STYLE_LIST_STYLE_LOWER_ALPHA: - case NS_STYLE_LIST_STYLE_UPPER_ALPHA: - case NS_STYLE_LIST_STYLE_LOWER_GREEK: - case NS_STYLE_LIST_STYLE_HEBREW: - case NS_STYLE_LIST_STYLE_ARMENIAN: - case NS_STYLE_LIST_STYLE_GEORGIAN: - case NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC: - case NS_STYLE_LIST_STYLE_HIRAGANA: - case NS_STYLE_LIST_STYLE_KATAKANA: - case NS_STYLE_LIST_STYLE_HIRAGANA_IROHA: - case NS_STYLE_LIST_STYLE_KATAKANA_IROHA: - case NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL: - case NS_STYLE_LIST_STYLE_JAPANESE_FORMAL: - case NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL: - case NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL: - case NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL: - case NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL: - case NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL: - case NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL: - case NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_JAPANESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_JAPANESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_CJK_HEAVENLY_STEM: - case NS_STYLE_LIST_STYLE_MOZ_CJK_EARTHLY_BRANCH: - case NS_STYLE_LIST_STYLE_MOZ_ARABIC_INDIC: - case NS_STYLE_LIST_STYLE_MOZ_PERSIAN: - case NS_STYLE_LIST_STYLE_MOZ_URDU: - case NS_STYLE_LIST_STYLE_MOZ_DEVANAGARI: - case NS_STYLE_LIST_STYLE_MOZ_GURMUKHI: - case NS_STYLE_LIST_STYLE_MOZ_GUJARATI: - case NS_STYLE_LIST_STYLE_MOZ_ORIYA: - case NS_STYLE_LIST_STYLE_MOZ_KANNADA: - case NS_STYLE_LIST_STYLE_MOZ_MALAYALAM: - case NS_STYLE_LIST_STYLE_MOZ_BENGALI: - case NS_STYLE_LIST_STYLE_MOZ_TAMIL: - case NS_STYLE_LIST_STYLE_MOZ_TELUGU: - case NS_STYLE_LIST_STYLE_MOZ_THAI: - case NS_STYLE_LIST_STYLE_MOZ_LAO: - case NS_STYLE_LIST_STYLE_MOZ_MYANMAR: - case NS_STYLE_LIST_STYLE_MOZ_KHMER: - case NS_STYLE_LIST_STYLE_MOZ_HANGUL: - case NS_STYLE_LIST_STYLE_MOZ_HANGUL_CONSONANT: - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME: - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_NUMERIC: - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_AM: - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ER: - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ET: + default: nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm), GetFontSizeInflation()); - GetListItemText(*myList, text); + GetListItemText(text); aRenderingContext.SetFont(fm); nscoord ascent = fm->MaxAscent(); aPt.MoveBy(mPadding.left, mPadding.top); @@ -1498,33 +1443,33 @@ nsBulletFrame::GetListItemSuffix(int32_t aListStyleType, } void -nsBulletFrame::GetListItemText(const nsStyleList& aListStyle, - nsString& result) +nsBulletFrame::GetListItemText(nsAString& aResult) { - NS_ASSERTION(aListStyle.mListStyleType != NS_STYLE_LIST_STYLE_NONE && - aListStyle.mListStyleType != NS_STYLE_LIST_STYLE_DISC && - aListStyle.mListStyleType != NS_STYLE_LIST_STYLE_CIRCLE && - aListStyle.mListStyleType != NS_STYLE_LIST_STYLE_SQUARE, + CounterStyle* style = StyleList()->GetCounterStyle(); + NS_ASSERTION(style->GetStyle() != NS_STYLE_LIST_STYLE_NONE && + style->GetStyle() != NS_STYLE_LIST_STYLE_DISC && + style->GetStyle() != NS_STYLE_LIST_STYLE_CIRCLE && + style->GetStyle() != NS_STYLE_LIST_STYLE_SQUARE, "we should be using specialized code for these types"); bool isRTL; - nsAutoString number; - AppendCounterText(aListStyle.mListStyleType, mOrdinal, number, isRTL); + nsAutoString counter, prefix, suffix; + style->GetPrefix(prefix); + style->GetSuffix(suffix); + style->GetCounterText(mOrdinal, counter, isRTL); - nsAutoString suffix; - GetListItemSuffix(aListStyle.mListStyleType, suffix); - - result.Truncate(); + aResult.Truncate(); + aResult.Append(prefix); if (GetWritingMode().IsBidiLTR() != isRTL) { - result.Append(number); + aResult.Append(counter); } else { // RLM = 0x200f, LRM = 0x200e char16_t mark = isRTL ? 0x200f : 0x200e; - result.Append(mark); - result.Append(number); - result.Append(mark); + aResult.Append(mark); + aResult.Append(counter); + aResult.Append(mark); } - result.Append(suffix); + aResult.Append(suffix); } #define MIN_BULLET_SIZE 1 @@ -1584,7 +1529,7 @@ nsBulletFrame::GetDesiredSize(nsPresContext* aCX, nscoord bulletSize; nsAutoString text; - switch (myList->mListStyleType) { + switch (myList->GetCounterStyle()->GetStyle()) { case NS_STYLE_LIST_STYLE_NONE: aMetrics.Width() = aMetrics.Height() = 0; aMetrics.SetBlockStartAscent(0); @@ -1614,63 +1559,7 @@ nsBulletFrame::GetDesiredSize(nsPresContext* aCX, } default: - case NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO: - case NS_STYLE_LIST_STYLE_DECIMAL: - case NS_STYLE_LIST_STYLE_CJK_DECIMAL: - case NS_STYLE_LIST_STYLE_LOWER_ROMAN: - case NS_STYLE_LIST_STYLE_UPPER_ROMAN: - case NS_STYLE_LIST_STYLE_LOWER_ALPHA: - case NS_STYLE_LIST_STYLE_UPPER_ALPHA: - case NS_STYLE_LIST_STYLE_KATAKANA: - case NS_STYLE_LIST_STYLE_HIRAGANA: - case NS_STYLE_LIST_STYLE_KATAKANA_IROHA: - case NS_STYLE_LIST_STYLE_HIRAGANA_IROHA: - case NS_STYLE_LIST_STYLE_LOWER_GREEK: - case NS_STYLE_LIST_STYLE_HEBREW: - case NS_STYLE_LIST_STYLE_ARMENIAN: - case NS_STYLE_LIST_STYLE_GEORGIAN: - case NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC: - case NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL: - case NS_STYLE_LIST_STYLE_JAPANESE_FORMAL: - case NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL: - case NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL: - case NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL: - case NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL: - case NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL: - case NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL: - case NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_JAPANESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_JAPANESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_CJK_HEAVENLY_STEM: - case NS_STYLE_LIST_STYLE_MOZ_CJK_EARTHLY_BRANCH: - case NS_STYLE_LIST_STYLE_MOZ_ARABIC_INDIC: - case NS_STYLE_LIST_STYLE_MOZ_PERSIAN: - case NS_STYLE_LIST_STYLE_MOZ_URDU: - case NS_STYLE_LIST_STYLE_MOZ_DEVANAGARI: - case NS_STYLE_LIST_STYLE_MOZ_GURMUKHI: - case NS_STYLE_LIST_STYLE_MOZ_GUJARATI: - case NS_STYLE_LIST_STYLE_MOZ_ORIYA: - case NS_STYLE_LIST_STYLE_MOZ_KANNADA: - case NS_STYLE_LIST_STYLE_MOZ_MALAYALAM: - case NS_STYLE_LIST_STYLE_MOZ_BENGALI: - case NS_STYLE_LIST_STYLE_MOZ_TAMIL: - case NS_STYLE_LIST_STYLE_MOZ_TELUGU: - case NS_STYLE_LIST_STYLE_MOZ_THAI: - case NS_STYLE_LIST_STYLE_MOZ_LAO: - case NS_STYLE_LIST_STYLE_MOZ_MYANMAR: - case NS_STYLE_LIST_STYLE_MOZ_KHMER: - case NS_STYLE_LIST_STYLE_MOZ_HANGUL: - case NS_STYLE_LIST_STYLE_MOZ_HANGUL_CONSONANT: - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME: - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_NUMERIC: - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_AM: - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ER: - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ET: - GetListItemText(*myList, text); + GetListItemText(text); aMetrics.Height() = fm->MaxHeight(); aRenderingContext->SetFont(fm); aMetrics.Width() = @@ -1883,8 +1772,8 @@ nsBulletFrame::GetBaseline() const nsRefPtr fm; nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm), GetFontSizeInflation()); - const nsStyleList* myList = StyleList(); - switch (myList->mListStyleType) { + CounterStyle* listStyleType = StyleList()->GetCounterStyle(); + switch (listStyleType->GetStyle()) { case NS_STYLE_LIST_STYLE_NONE: break; @@ -1906,6 +1795,22 @@ nsBulletFrame::GetBaseline() const return ascent + GetUsedBorderAndPadding().top; } +void +nsBulletFrame::GetSpokenText(nsAString& aText) +{ + CounterStyle* style = StyleList()->GetCounterStyle(); + bool isBullet; + style->GetSpokenCounterText(mOrdinal, aText, isBullet); + if (isBullet) { + aText.Append(' '); + } else { + nsAutoString prefix, suffix; + style->GetPrefix(prefix); + style->GetSuffix(suffix); + aText = prefix + aText + suffix; + } +} + diff --git a/layout/generic/nsBulletFrame.h b/layout/generic/nsBulletFrame.h index 354e9be81fb..26cc466ddb8 100644 --- a/layout/generic/nsBulletFrame.h +++ b/layout/generic/nsBulletFrame.h @@ -88,7 +88,9 @@ public: nsString& aResult); /* get list item text, with '.' */ - void GetListItemText(const nsStyleList& aStyleList, nsString& aResult); + void GetListItemText(nsAString& aResult); + + void GetSpokenText(nsAString& aText); void PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt, const nsRect& aDirtyRect, uint32_t aFlags); diff --git a/layout/generic/nsHTMLReflowState.cpp b/layout/generic/nsHTMLReflowState.cpp index a61932233c5..0d2c9ed4386 100644 --- a/layout/generic/nsHTMLReflowState.cpp +++ b/layout/generic/nsHTMLReflowState.cpp @@ -27,6 +27,7 @@ #include "nsFontInflationData.h" #include "StickyScrollContainer.h" #include "nsIFrameInlines.h" +#include "CounterStyleManager.h" #include #include "mozilla/dom/HTMLInputElement.h" @@ -107,23 +108,26 @@ FontSizeInflationListMarginAdjustment(const nsIFrame* aFrame) float inflation = nsLayoutUtils::FontSizeInflationFor(aFrame); if (aFrame->IsFrameOfType(nsIFrame::eBlockFrame)) { const nsBlockFrame* blockFrame = static_cast(aFrame); - const nsStyleList* styleList = aFrame->StyleList(); // We only want to adjust the margins if we're dealing with an ordered // list. if (inflation > 1.0f && blockFrame->HasBullet() && - styleList->mListStyleType != NS_STYLE_LIST_STYLE_NONE && - styleList->mListStyleType != NS_STYLE_LIST_STYLE_DISC && - styleList->mListStyleType != NS_STYLE_LIST_STYLE_CIRCLE && - styleList->mListStyleType != NS_STYLE_LIST_STYLE_SQUARE && inflation > 1.0f) { - // The HTML spec states that the default padding for ordered lists begins - // at 40px, indicating that we have 40px of space to place a bullet. When - // performing font inflation calculations, we add space equivalent to this, - // but simply inflated at the same amount as the text, in app units. - return nsPresContext::CSSPixelsToAppUnits(40) * (inflation - 1); + auto listStyleType = aFrame->StyleList()->GetCounterStyle()->GetStyle(); + if (listStyleType != NS_STYLE_LIST_STYLE_NONE && + listStyleType != NS_STYLE_LIST_STYLE_DISC && + listStyleType != NS_STYLE_LIST_STYLE_CIRCLE && + listStyleType != NS_STYLE_LIST_STYLE_SQUARE) { + // The HTML spec states that the default padding for ordered lists + // begins at 40px, indicating that we have 40px of space to place a + // bullet. When performing font inflation calculations, we add space + // equivalent to this, but simply inflated at the same amount as the + // text, in app units. + return nsPresContext::CSSPixelsToAppUnits(40) * (inflation - 1); + } + } } diff --git a/layout/reftests/counters/counter-reset-integer-range-ref.html b/layout/reftests/counters/counter-reset-integer-range-ref.html index 9aea6b1c9bc..dfc950bc1c0 100644 --- a/layout/reftests/counters/counter-reset-integer-range-ref.html +++ b/layout/reftests/counters/counter-reset-integer-range-ref.html @@ -5,5 +5,5 @@ 2147483647 2147483647 -2147483647 --2147483648 --2147483648 +-2147483647 +-2147483647 diff --git a/layout/reftests/counters/counter-ua-limits-02-ref.html b/layout/reftests/counters/counter-ua-limits-02-ref.html index 58894ec70a7..2715253f3f5 100644 --- a/layout/reftests/counters/counter-ua-limits-02-ref.html +++ b/layout/reftests/counters/counter-ua-limits-02-ref.html @@ -18,8 +18,8 @@
-2147483646 -2147483647 - -2147483648 - -2147483648 + -2147483647 + -2147483647
diff --git a/layout/reftests/counters/reftest.list b/layout/reftests/counters/reftest.list index 39426b9ff18..ef0ea7d5ebd 100644 --- a/layout/reftests/counters/reftest.list +++ b/layout/reftests/counters/reftest.list @@ -60,10 +60,10 @@ fails-if(B2G&&browserIsRemote) == t1204-reset-02-c-o-test.html t1204-reset-02-c- == text-boundaries-subpixel.html text-boundaries-subpixel-ref.html == counter-hebrew-test.html counter-hebrew-reference.html == counters-hebrew-test.html counters-hebrew-reference.html -== counter-reset-integer-range.html counter-reset-integer-range-ref.html +fails-if(xulRuntime.XPCOMABI.match(/arm/)) == counter-reset-integer-range.html counter-reset-integer-range-ref.html # bug 989718 == counter-ua-limits-00.html counter-ua-limits-00-ref.html == counter-ua-limits-01.html counter-ua-limits-01-ref.html -== counter-ua-limits-02.html counter-ua-limits-02-ref.html +fails-if(xulRuntime.XPCOMABI.match(/arm/)) == counter-ua-limits-02.html counter-ua-limits-02-ref.html # bug 989718 == counter-ua-limits-03.html counter-ua-limits-03-ref.html == counter-ua-limits-list-00.html counter-ua-limits-list-00-ref.html == counter-ua-limits-list-01.html counter-ua-limits-list-01-ref.html diff --git a/layout/reftests/counters/t1202-counter-16-f-test.html b/layout/reftests/counters/t1202-counter-16-f-test.html index 4b6297a717f..c0954d58e42 100644 --- a/layout/reftests/counters/t1202-counter-16-f-test.html +++ b/layout/reftests/counters/t1202-counter-16-f-test.html @@ -15,7 +15,6 @@ content: counter(f, ".", decimal); content: counter(f, decimal, "."); content: counter(f, decimal, decimal); - content: counter(f, unknowntype); } diff --git a/layout/reftests/counters/t1202-counters-18-f-test.html b/layout/reftests/counters/t1202-counters-18-f-test.html index 0e4e4005cc5..58d3f24e7aa 100644 --- a/layout/reftests/counters/t1202-counters-18-f-test.html +++ b/layout/reftests/counters/t1202-counters-18-f-test.html @@ -16,7 +16,6 @@ content: counters(f, decimal, "."); content: counters(f, ".", decimal, decimal); content: counters(f, ".", decimal, "."); - content: counters(f, ".", unknowntype); } diff --git a/layout/style/Declaration.cpp b/layout/style/Declaration.cpp index 90b427141ed..4cf148bdaf5 100644 --- a/layout/style/Declaration.cpp +++ b/layout/style/Declaration.cpp @@ -715,15 +715,15 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, break; } case eCSSProperty_list_style: - if (AppendValueToString(eCSSProperty_list_style_type, aValue, - aSerialization)) { - aValue.Append(char16_t(' ')); - } if (AppendValueToString(eCSSProperty_list_style_position, aValue, aSerialization)) { aValue.Append(char16_t(' ')); } - AppendValueToString(eCSSProperty_list_style_image, aValue, + if (AppendValueToString(eCSSProperty_list_style_image, aValue, + aSerialization)) { + aValue.Append(char16_t(' ')); + } + AppendValueToString(eCSSProperty_list_style_type, aValue, aSerialization); break; case eCSSProperty_overflow: { diff --git a/layout/style/moz.build b/layout/style/moz.build index 7af7d1690e4..906a42071a6 100644 --- a/layout/style/moz.build +++ b/layout/style/moz.build @@ -9,6 +9,7 @@ TEST_TOOL_DIRS += ['test'] EXPORTS += [ 'AnimationCommon.h', + 'CounterStyleManager.h', 'nsAnimationManager.h', 'nsComputedDOMStylePropertyList.h', 'nsCSSAnonBoxes.h', diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index fe4f5ac57c7..d71a75585b2 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -9,6 +9,7 @@ #include "mozilla/ArrayUtils.h" #include "mozilla/DebugOnly.h" #include "mozilla/Move.h" +#include "mozilla/MathAlgorithms.h" #include "nsCSSParser.h" #include "nsCSSProps.h" @@ -749,6 +750,7 @@ protected: bool ParseFontSrcFormat(InfallibleTArray& values); bool ParseFontRanges(nsCSSValue& aValue); bool ParseListStyle(); + bool ParseListStyleType(nsCSSValue& aValue); bool ParseMargin(); bool ParseMarks(nsCSSValue& aValue); bool ParseTransform(bool aIsPrefixed); @@ -6989,24 +6991,15 @@ CSSParserImpl::ParseCounter(nsCSSValue& aValue) } // get optional type - int32_t type = NS_STYLE_LIST_STYLE_DECIMAL; + nsString type = NS_LITERAL_STRING("decimal"); if (ExpectSymbol(',', true)) { - if (!GetToken(true)) { - break; - } - nsCSSKeyword keyword; - if (eCSSToken_Ident != mToken.mType || - (keyword = nsCSSKeywords::LookupKeyword(mToken.mIdent)) == - eCSSKeyword_UNKNOWN || - !nsCSSProps::FindKeyword(keyword, nsCSSProps::kListStyleKTable, - type)) { - UngetToken(); + if (!ParseCounterStyleName(type, false)) { break; } } int32_t typeItem = eCSSUnit_Counters == unit ? 2 : 1; - val->Item(typeItem).SetIntValue(type, eCSSUnit_Enumerated); + val->Item(typeItem).SetStringValue(type, eCSSUnit_Ident); if (!ExpectSymbol(')', true)) { break; @@ -9704,6 +9697,8 @@ CSSParserImpl::ParseSingleValueProperty(nsCSSValue& aValue, return ParseFontWeight(aValue); case eCSSProperty_image_orientation: return ParseImageOrientation(aValue); + case eCSSProperty_list_style_type: + return ParseListStyleType(aValue); case eCSSProperty_marks: return ParseMarks(aValue); case eCSSProperty_text_align: @@ -12404,14 +12399,16 @@ bool CSSParserImpl::ParseListStyle() { // 'list-style' can accept 'none' for two different subproperties, - // 'list-style-type' and 'list-style-position'. In order to accept + // 'list-style-type' and 'list-style-image'. In order to accept // 'none' as the value of either but still allow another value for // either, we need to ensure that the first 'none' we find gets - // allocated to a dummy property instead. + // allocated to a dummy property instead. Since parse function for + // 'list-style-type' could accept values for 'list-style-position', + // we put position in front of type. static const nsCSSProperty listStyleIDs[] = { eCSSPropertyExtra_x_none_value, - eCSSProperty_list_style_type, eCSSProperty_list_style_position, + eCSSProperty_list_style_type, eCSSProperty_list_style_image }; @@ -12422,7 +12419,7 @@ CSSParserImpl::ParseListStyle() return false; } - if ((found & (1|2|8)) == (1|2|8)) { + if ((found & (1|4|8)) == (1|4|8)) { if (values[0].GetUnit() == eCSSUnit_None) { // We found a 'none' plus another value for both of // 'list-style-type' and 'list-style-image'. This is a parse @@ -12435,17 +12432,15 @@ CSSParserImpl::ParseListStyle() } } - // Provide default values if ((found & 2) == 0) { - if (found & 1) { - values[1].SetIntValue(NS_STYLE_LIST_STYLE_NONE, eCSSUnit_Enumerated); - } else { - values[1].SetIntValue(NS_STYLE_LIST_STYLE_DISC, eCSSUnit_Enumerated); - } + values[1].SetIntValue(NS_STYLE_LIST_STYLE_POSITION_OUTSIDE, + eCSSUnit_Enumerated); } if ((found & 4) == 0) { - values[2].SetIntValue(NS_STYLE_LIST_STYLE_POSITION_OUTSIDE, - eCSSUnit_Enumerated); + // Provide default values + nsString type = (found & 1) ? + NS_LITERAL_STRING("none") : NS_LITERAL_STRING("disc"); + values[2].SetStringValue(type, eCSSUnit_Ident); } if ((found & 8) == 0) { values[3].SetNoneValue(); @@ -12458,6 +12453,21 @@ CSSParserImpl::ParseListStyle() return true; } +bool +CSSParserImpl::ParseListStyleType(nsCSSValue& aValue) +{ + if (ParseVariant(aValue, VARIANT_INHERIT, nullptr)) { + return true; + } + + nsString name; + if (ParseCounterStyleName(name, false)) { + aValue.SetStringValue(name, eCSSUnit_Ident); + return true; + } + return false; +} + bool CSSParserImpl::ParseMargin() { diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index 6311ac74082..f9b082dd52d 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -2254,10 +2254,11 @@ CSS_PROP_LIST( list-style-type, list_style_type, ListStyleType, - CSS_PROPERTY_PARSE_VALUE, + CSS_PROPERTY_PARSE_VALUE | + CSS_PROPERTY_VALUE_PARSER_FUNCTION, "", - VARIANT_HK, - kListStyleKTable, + 0, + nullptr, CSS_PROP_NO_OFFSET, eStyleAnimType_None) CSS_PROP_SHORTHAND( diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 4374e81f6d4..fd6b511c303 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -1098,13 +1098,12 @@ nsComputedDOMStyle::DoGetContent() nsDependentString(a->Item(1).GetStringBufferValue()), str); } NS_ABORT_IF_FALSE(eCSSUnit_None != a->Item(typeItem).GetUnit(), - "'none' should be handled as enumerated value"); - int32_t type = a->Item(typeItem).GetIntValue(); - if (type != NS_STYLE_LIST_STYLE_DECIMAL) { + "'none' should be handled as identifier value"); + nsString type; + a->Item(typeItem).GetStringValue(type); + if (!type.LowerCaseEqualsLiteral("decimal")) { str.AppendLiteral(", "); - AppendASCIItoUTF16( - nsCSSProps::ValueToKeyword(type, nsCSSProps::kListStyleKTable), - str); + nsStyleUtil::AppendEscapedCSSIdent(type, str); } str.Append(char16_t(')')); @@ -2992,9 +2991,12 @@ CSSValue* nsComputedDOMStyle::DoGetListStyleType() { nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue; - val->SetIdent( - nsCSSProps::ValueToKeywordEnum(StyleList()->mListStyleType, - nsCSSProps::kListStyleKTable)); + // want SetIdent + nsString type; + StyleList()->GetListStyleType(type); + nsString value; + nsStyleUtil::AppendEscapedCSSIdent(type, value); + val->SetString(value); return val; } diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 079d4146248..7c26a7aa900 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -45,6 +45,7 @@ #include "prtime.h" #include "CSSVariableResolver.h" #include "nsCSSParser.h" +#include "CounterStyleManager.h" #if defined(_MSC_VER) || defined(__MINGW32__) #include @@ -2387,7 +2388,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex } case eStyleStruct_List: { - nsStyleList* list = new (mPresContext) nsStyleList(); + nsStyleList* list = new (mPresContext) nsStyleList(mPresContext); aContext->SetStyle(eStyleStruct_List, list); return list; } @@ -7016,14 +7017,42 @@ nsRuleNode::ComputeListData(void* aStartStruct, const RuleDetail aRuleDetail, const bool aCanStoreInRuleTree) { - COMPUTE_START_INHERITED(List, (), list, parentList) + COMPUTE_START_INHERITED(List, (mPresContext), list, parentList) - // list-style-type: enum, inherit, initial - SetDiscrete(*aRuleData->ValueForListStyleType(), - list->mListStyleType, canStoreInRuleTree, - SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT, - parentList->mListStyleType, - NS_STYLE_LIST_STYLE_DISC, 0, 0, 0, 0); + // list-style-type: string, none, inherit, initial + const nsCSSValue* typeValue = aRuleData->ValueForListStyleType(); + switch (typeValue->GetUnit()) { + case eCSSUnit_Unset: + case eCSSUnit_Inherit: { + canStoreInRuleTree = false; + nsString type; + parentList->GetListStyleType(type); + list->SetListStyleType(type, parentList->GetCounterStyle()); + break; + } + case eCSSUnit_Initial: + list->SetListStyleType(NS_LITERAL_STRING("disc"), mPresContext); + break; + case eCSSUnit_Ident: { + nsString typeIdent; + typeValue->GetStringValue(typeIdent); + list->SetListStyleType(typeIdent, mPresContext); + break; + } + case eCSSUnit_Enumerated: + // For compatibility with html attribute map. + // This branch should never be called for value from CSS. + list->SetListStyleType( + NS_ConvertASCIItoUTF16( + nsCSSProps::ValueToKeyword( + typeValue->GetIntValue(), nsCSSProps::kListStyleKTable)), + mPresContext); + break; + case eCSSUnit_Null: + break; + default: + NS_NOTREACHED("Unexpected value unit"); + } // list-style-image: url, none, inherit const nsCSSValue* imageValue = aRuleData->ValueForListStyleImage(); diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 1ec3143e831..47d0748cce2 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -25,6 +25,7 @@ #include "imgIRequest.h" #include "imgIContainer.h" +#include "CounterStyleManager.h" #include "mozilla/Likely.h" #include "nsIURI.h" @@ -651,9 +652,11 @@ nsChangeHint nsStyleOutline::CalcDifference(const nsStyleOutline& aOther) const // -------------------- // nsStyleList // -nsStyleList::nsStyleList() - : mListStyleType(NS_STYLE_LIST_STYLE_DISC), - mListStylePosition(NS_STYLE_LIST_STYLE_POSITION_OUTSIDE) +nsStyleList::nsStyleList(nsPresContext* aPresContext) + : mListStylePosition(NS_STYLE_LIST_STYLE_POSITION_OUTSIDE), + mListStyleType(NS_LITERAL_STRING("disc")), + mCounterStyle(aPresContext->CounterStyleManager()-> + BuildCounterStyle(mListStyleType)) { MOZ_COUNT_CTOR(nsStyleList); } @@ -664,8 +667,9 @@ nsStyleList::~nsStyleList() } nsStyleList::nsStyleList(const nsStyleList& aSource) - : mListStyleType(aSource.mListStyleType), - mListStylePosition(aSource.mListStylePosition), + : mListStylePosition(aSource.mListStylePosition), + mListStyleType(aSource.mListStyleType), + mCounterStyle(aSource.mCounterStyle), mImageRegion(aSource.mImageRegion) { SetListStyleImage(aSource.GetListStyleImage()); diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index d9b38bea625..f162bf7a4ca 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -27,6 +27,7 @@ #include "nsCSSValue.h" #include "imgRequestProxy.h" #include "Orientation.h" +#include "CounterStyleManager.h" class nsIFrame; class nsIURI; @@ -1108,7 +1109,7 @@ protected: struct nsStyleList { - nsStyleList(void); + nsStyleList(nsPresContext* aPresContext); nsStyleList(const nsStyleList& aStyleList); ~nsStyleList(void); @@ -1141,9 +1142,28 @@ struct nsStyleList { mListStyleImage->LockImage(); } - uint8_t mListStyleType; // [inherited] See nsStyleConsts.h + void GetListStyleType(nsSubstring& aType) const { aType = mListStyleType; } + mozilla::CounterStyle* GetCounterStyle() const + { + return mCounterStyle.get(); + } + void SetListStyleType(const nsSubstring& aType, + mozilla::CounterStyle* aStyle) + { + mListStyleType = aType; + mCounterStyle = aStyle; + } + void SetListStyleType(const nsSubstring& aType, + nsPresContext* aPresContext) + { + SetListStyleType(aType, aPresContext-> + CounterStyleManager()->BuildCounterStyle(aType)); + } + uint8_t mListStylePosition; // [inherited] private: + nsString mListStyleType; // [inherited] + nsRefPtr mCounterStyle; // [inherited] nsRefPtr mListStyleImage; // [inherited] nsStyleList& operator=(const nsStyleList& aOther) MOZ_DELETE; public: diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 37a864fed2c..508f2ff2ad3 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -2615,7 +2615,7 @@ var gCSSProperties = { type: CSS_TYPE_TRUE_SHORTHAND, subproperties: [ "list-style-type", "list-style-position", "list-style-image" ], initial_values: [ "outside", "disc", "disc outside", "outside disc", "disc none", "none disc", "none disc outside", "none outside disc", "disc none outside", "disc outside none", "outside none disc", "outside disc none" ], - other_values: [ "inside none", "none inside", "none none inside", "square", "none", "none none", "outside none none", "none outside none", "none none outside", "none outside", "outside none", + other_values: [ "inside none", "none inside", "none none inside", "square", "none", "none none", "outside none none", "none outside none", "none none outside", "none outside", "outside none", "outside outside", "outside inside", "\\32 style", "\\32 style inside", 'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAKElEQVR42u3NQQ0AAAgEoNP+nTWFDzcoQE1udQQCgUAgEAgEAsGTYAGjxAE/G/Q2tQAAAABJRU5ErkJggg==")', 'none url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAKElEQVR42u3NQQ0AAAgEoNP+nTWFDzcoQE1udQQCgUAgEAgEAsGTYAGjxAE/G/Q2tQAAAABJRU5ErkJggg==")', 'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAKElEQVR42u3NQQ0AAAgEoNP+nTWFDzcoQE1udQQCgUAgEAgEAsGTYAGjxAE/G/Q2tQAAAABJRU5ErkJggg==") none', @@ -2628,7 +2628,7 @@ var gCSSProperties = { 'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAKElEQVR42u3NQQ0AAAgEoNP+nTWFDzcoQE1udQQCgUAgEAgEAsGTYAGjxAE/G/Q2tQAAAABJRU5ErkJggg==") outside none', 'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAKElEQVR42u3NQQ0AAAgEoNP+nTWFDzcoQE1udQQCgUAgEAgEAsGTYAGjxAE/G/Q2tQAAAABJRU5ErkJggg==") none outside' ], - invalid_values: [ "outside outside", "disc disc", "unknown value", "none none none", "none disc url(404.png)", "none url(404.png) disc", "disc none url(404.png)", "disc url(404.png) none", "url(404.png) none disc", "url(404.png) disc none", "none disc outside url(404.png)" ] + invalid_values: [ "disc disc", "unknown value", "none none none", "none disc url(404.png)", "none url(404.png) disc", "disc none url(404.png)", "disc url(404.png) none", "url(404.png) none disc", "url(404.png) disc none", "none disc outside url(404.png)" ] }, "list-style-image": { domProp: "listStyleImage", @@ -2683,7 +2683,8 @@ var gCSSProperties = { "-moz-hangul", "-moz-hangul-consonant", "-moz-ethiopic-halehame", "-moz-ethiopic-numeric", "-moz-ethiopic-halehame-am", - "-moz-ethiopic-halehame-ti-er", "-moz-ethiopic-halehame-ti-et" + "-moz-ethiopic-halehame-ti-er", "-moz-ethiopic-halehame-ti-et", + "other-style", "inside", "outside", "\\32 style" ], invalid_values: [] }, diff --git a/layout/style/test/test_garbage_at_end_of_declarations.html b/layout/style/test/test_garbage_at_end_of_declarations.html index 62d0de87408..6160cbda086 100644 --- a/layout/style/test/test_garbage_at_end_of_declarations.html +++ b/layout/style/test/test_garbage_at_end_of_declarations.html @@ -50,6 +50,13 @@ var gAllowsExtra = { "font": { "caption": true, "icon": true, "menu": true, "message-box": true, "small-caption": true, "status-bar": true }, "voice-family": {}, + "list-style": { + "inside none": true, "none inside": true, "none": true, + "none outside": true, "outside none": true, + 'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAKElEQVR42u3NQQ0AAAgEoNP+nTWFDzcoQE1udQQCgUAgEAgEAsGTYAGjxAE/G/Q2tQAAAABJRU5ErkJggg==")': true, + 'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAKElEQVR42u3NQQ0AAAgEoNP+nTWFDzcoQE1udQQCgUAgEAgEAsGTYAGjxAE/G/Q2tQAAAABJRU5ErkJggg==") outside': true, + 'outside url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAKElEQVR42u3NQQ0AAAgEoNP+nTWFDzcoQE1udQQCgUAgEAgEAsGTYAGjxAE/G/Q2tQAAAABJRU5ErkJggg==")': true + }, }; /* These are the reverse of the above list; they're the unusual values From 25d22122bf9508099aaca2284bdc462021d25ebb Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 11 Jun 2014 21:12:00 -0400 Subject: [PATCH 09/68] Bug 966166 - Part 4: Rewrite some builtin counter styles. r=dbaron --- content/svg/document/src/SVGDocument.cpp | 1 + layout/base/nsDocumentViewer.cpp | 5 + layout/generic/nsBulletFrame.cpp | 533 ----------------------- layout/style/CounterStyleManager.cpp | 135 +----- layout/style/counterstyles.css | 265 +++++++++++ layout/style/jar.mn | 1 + layout/style/nsCSSKeywordList.h | 40 -- layout/style/nsCSSProps.cpp | 47 +- layout/style/nsLayoutStylesheetCache.cpp | 17 + layout/style/nsLayoutStylesheetCache.h | 2 + layout/style/nsStyleConsts.h | 75 +--- 11 files changed, 320 insertions(+), 801 deletions(-) create mode 100644 layout/style/counterstyles.css diff --git a/content/svg/document/src/SVGDocument.cpp b/content/svg/document/src/SVGDocument.cpp index 2e799016abd..b256c839a8a 100644 --- a/content/svg/document/src/SVGDocument.cpp +++ b/content/svg/document/src/SVGDocument.cpp @@ -161,6 +161,7 @@ SVGDocument::EnsureNonSVGUserAgentStyleSheetsLoaded() EnsureOnDemandBuiltInUASheet(sheet); } EnsureOnDemandBuiltInUASheet(nsLayoutStylesheetCache::FormsSheet()); + EnsureOnDemandBuiltInUASheet(nsLayoutStylesheetCache::CounterStylesSheet()); EnsureOnDemandBuiltInUASheet(nsLayoutStylesheetCache::HTMLSheet()); EnsureOnDemandBuiltInUASheet(nsLayoutStylesheetCache::UASheet()); } diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 9a150d6cf9d..f1114606423 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -2332,6 +2332,11 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument, styleSet->PrependStyleSheet(nsStyleSet::eAgentSheet, sheet); } + sheet = nsLayoutStylesheetCache::CounterStylesSheet(); + if (sheet) { + styleSet->PrependStyleSheet(nsStyleSet::eAgentSheet, sheet); + } + sheet = nsLayoutStylesheetCache::HTMLSheet(); if (sheet) { styleSet->PrependStyleSheet(nsStyleSet::eAgentSheet, sheet); diff --git a/layout/generic/nsBulletFrame.cpp b/layout/generic/nsBulletFrame.cpp index aaab13e37eb..6089c71e706 100644 --- a/layout/generic/nsBulletFrame.cpp +++ b/layout/generic/nsBulletFrame.cpp @@ -406,9 +406,6 @@ nsBulletFrame::SetListItemOrdinal(int32_t aNextOrdinal, } -// XXX change roman/alpha to use unsigned math so that maxint and -// maxnegint will work - /** * For all functions below, a return value of true means that we * could represent mOrder in the desired numbering system. false @@ -421,30 +418,6 @@ static bool DecimalToText(int32_t ordinal, nsString& result) result.AppendASCII(cbuf); return true; } -static bool DecimalLeadingZeroToText(int32_t ordinal, nsString& result) -{ - char cbuf[40]; - PR_snprintf(cbuf, sizeof(cbuf), "%02ld", ordinal); - result.AppendASCII(cbuf); - return true; -} -static bool OtherDecimalToText(int32_t ordinal, char16_t zeroChar, nsString& result) -{ - char16_t diff = zeroChar - char16_t('0'); - // We're going to be appending to whatever is in "result" already, so make - // sure to only munge the new bits. Note that we can't just grab the pointer - // to the new stuff here, since appending to the string can realloc. - size_t offset = result.Length(); - DecimalToText(ordinal, result); - char16_t* p = result.BeginWriting() + offset; - if (ordinal < 0) { - // skip the leading '-' - ++p; - } - for(; '\0' != *p ; p++) - *p += diff; - return true; -} static bool TamilToText(int32_t ordinal, nsString& result) { if (ordinal < 1 || ordinal > 9999) { @@ -464,231 +437,6 @@ static bool TamilToText(int32_t ordinal, nsString& result) return true; } - -static const char gLowerRomanCharsA[] = "ixcm"; -static const char gUpperRomanCharsA[] = "IXCM"; -static const char gLowerRomanCharsB[] = "vld"; -static const char gUpperRomanCharsB[] = "VLD"; - -static bool RomanToText(int32_t ordinal, nsString& result, const char* achars, const char* bchars) -{ - if (ordinal < 1 || ordinal > 3999) { - return false; - } - nsAutoString addOn, decStr; - decStr.AppendInt(ordinal, 10); - int len = decStr.Length(); - const char16_t* dp = decStr.get(); - const char16_t* end = dp + len; - int romanPos = len; - int n; - - for (; dp < end; dp++) { - romanPos--; - addOn.SetLength(0); - switch(*dp) { - case '3': - addOn.Append(char16_t(achars[romanPos])); - // FALLTHROUGH - case '2': - addOn.Append(char16_t(achars[romanPos])); - // FALLTHROUGH - case '1': - addOn.Append(char16_t(achars[romanPos])); - break; - case '4': - addOn.Append(char16_t(achars[romanPos])); - // FALLTHROUGH - case '5': case '6': - case '7': case '8': - addOn.Append(char16_t(bchars[romanPos])); - for(n=0;'5'+n<*dp;n++) { - addOn.Append(char16_t(achars[romanPos])); - } - break; - case '9': - addOn.Append(char16_t(achars[romanPos])); - addOn.Append(char16_t(achars[romanPos+1])); - break; - default: - break; - } - result.Append(addOn); - } - return true; -} - -#define ALPHA_SIZE 26 -static const char16_t gLowerAlphaChars[ALPHA_SIZE] = -{ -0x0061, 0x0062, 0x0063, 0x0064, 0x0065, // A B C D E -0x0066, 0x0067, 0x0068, 0x0069, 0x006A, // F G H I J -0x006B, 0x006C, 0x006D, 0x006E, 0x006F, // K L M N O -0x0070, 0x0071, 0x0072, 0x0073, 0x0074, // P Q R S T -0x0075, 0x0076, 0x0077, 0x0078, 0x0079, // U V W X Y -0x007A // Z -}; - -static const char16_t gUpperAlphaChars[ALPHA_SIZE] = -{ -0x0041, 0x0042, 0x0043, 0x0044, 0x0045, // A B C D E -0x0046, 0x0047, 0x0048, 0x0049, 0x004A, // F G H I J -0x004B, 0x004C, 0x004D, 0x004E, 0x004F, // K L M N O -0x0050, 0x0051, 0x0052, 0x0053, 0x0054, // P Q R S T -0x0055, 0x0056, 0x0057, 0x0058, 0x0059, // U V W X Y -0x005A // Z -}; - - -#define KATAKANA_CHARS_SIZE 48 -// Page 94 Writing Systems of The World -// after modification by momoi -static const char16_t gKatakanaChars[KATAKANA_CHARS_SIZE] = -{ -0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, // a i u e o -0x30AB, 0x30AD, 0x30AF, 0x30B1, 0x30B3, // ka ki ku ke ko -0x30B5, 0x30B7, 0x30B9, 0x30BB, 0x30BD, // sa shi su se so -0x30BF, 0x30C1, 0x30C4, 0x30C6, 0x30C8, // ta chi tsu te to -0x30CA, 0x30CB, 0x30CC, 0x30CD, 0x30CE, // na ni nu ne no -0x30CF, 0x30D2, 0x30D5, 0x30D8, 0x30DB, // ha hi hu he ho -0x30DE, 0x30DF, 0x30E0, 0x30E1, 0x30E2, // ma mi mu me mo -0x30E4, 0x30E6, 0x30E8, // ya yu yo -0x30E9, 0x30EA, 0x30EB, 0x30EC, 0x30ED, // ra ri ru re ro -0x30EF, 0x30F0, 0x30F1, 0x30F2, // wa (w)i (w)e (w)o -0x30F3 // n -}; - -#define HIRAGANA_CHARS_SIZE 48 -static const char16_t gHiraganaChars[HIRAGANA_CHARS_SIZE] = -{ -0x3042, 0x3044, 0x3046, 0x3048, 0x304A, // a i u e o -0x304B, 0x304D, 0x304F, 0x3051, 0x3053, // ka ki ku ke ko -0x3055, 0x3057, 0x3059, 0x305B, 0x305D, // sa shi su se so -0x305F, 0x3061, 0x3064, 0x3066, 0x3068, // ta chi tsu te to -0x306A, 0x306B, 0x306C, 0x306D, 0x306E, // na ni nu ne no -0x306F, 0x3072, 0x3075, 0x3078, 0x307B, // ha hi hu he ho -0x307E, 0x307F, 0x3080, 0x3081, 0x3082, // ma mi mu me mo -0x3084, 0x3086, 0x3088, // ya yu yo -0x3089, 0x308A, 0x308B, 0x308C, 0x308D, // ra ri ru re ro -0x308F, 0x3090, 0x3091, 0x3092, // wa (w)i (w)e (w)o -0x3093 // n -}; - - -#define HIRAGANA_IROHA_CHARS_SIZE 47 -// Page 94 Writing Systems of The World -static const char16_t gHiraganaIrohaChars[HIRAGANA_IROHA_CHARS_SIZE] = -{ -0x3044, 0x308D, 0x306F, 0x306B, 0x307B, // i ro ha ni ho -0x3078, 0x3068, 0x3061, 0x308A, 0x306C, // he to chi ri nu -0x308B, 0x3092, 0x308F, 0x304B, 0x3088, // ru (w)o wa ka yo -0x305F, 0x308C, 0x305D, 0x3064, 0x306D, // ta re so tsu ne -0x306A, 0x3089, 0x3080, 0x3046, 0x3090, // na ra mu u (w)i -0x306E, 0x304A, 0x304F, 0x3084, 0x307E, // no o ku ya ma -0x3051, 0x3075, 0x3053, 0x3048, 0x3066, // ke hu ko e te -0x3042, 0x3055, 0x304D, 0x3086, 0x3081, // a sa ki yu me -0x307F, 0x3057, 0x3091, 0x3072, 0x3082, // mi shi (w)e hi mo -0x305B, 0x3059 // se su -}; - -#define KATAKANA_IROHA_CHARS_SIZE 47 -static const char16_t gKatakanaIrohaChars[KATAKANA_IROHA_CHARS_SIZE] = -{ -0x30A4, 0x30ED, 0x30CF, 0x30CB, 0x30DB, // i ro ha ni ho -0x30D8, 0x30C8, 0x30C1, 0x30EA, 0x30CC, // he to chi ri nu -0x30EB, 0x30F2, 0x30EF, 0x30AB, 0x30E8, // ru (w)o wa ka yo -0x30BF, 0x30EC, 0x30BD, 0x30C4, 0x30CD, // ta re so tsu ne -0x30CA, 0x30E9, 0x30E0, 0x30A6, 0x30F0, // na ra mu u (w)i -0x30CE, 0x30AA, 0x30AF, 0x30E4, 0x30DE, // no o ku ya ma -0x30B1, 0x30D5, 0x30B3, 0x30A8, 0x30C6, // ke hu ko e te -0x30A2, 0x30B5, 0x30AD, 0x30E6, 0x30E1, // a sa ki yu me -0x30DF, 0x30B7, 0x30F1, 0x30D2, 0x30E2, // mi shi (w)e hi mo -0x30BB, 0x30B9 // se su -}; - -#define LOWER_GREEK_CHARS_SIZE 24 -// Note: 0x03C2 GREEK FINAL SIGMA is not used in here.... -static const char16_t gLowerGreekChars[LOWER_GREEK_CHARS_SIZE] = -{ -0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, // alpha beta gamma delta epsilon -0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, // zeta eta theta iota kappa -0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, // lamda mu nu xi omicron -0x03C0, 0x03C1, 0x03C3, 0x03C4, 0x03C5, // pi rho sigma tau upsilon -0x03C6, 0x03C7, 0x03C8, 0x03C9 // phi chi psi omega -}; - -#define CJK_HEAVENLY_STEM_CHARS_SIZE 10 -static const char16_t gCJKHeavenlyStemChars[CJK_HEAVENLY_STEM_CHARS_SIZE] = -{ -0x7532, 0x4e59, 0x4e19, 0x4e01, 0x620a, -0x5df1, 0x5e9a, 0x8f9b, 0x58ec, 0x7678 -}; -#define CJK_EARTHLY_BRANCH_CHARS_SIZE 12 -static const char16_t gCJKEarthlyBranchChars[CJK_EARTHLY_BRANCH_CHARS_SIZE] = -{ -0x5b50, 0x4e11, 0x5bc5, 0x536f, 0x8fb0, 0x5df3, -0x5348, 0x672a, 0x7533, 0x9149, 0x620c, 0x4ea5 -}; -#define HANGUL_CHARS_SIZE 14 -static const char16_t gHangulChars[HANGUL_CHARS_SIZE] = -{ -0xac00, 0xb098, 0xb2e4, 0xb77c, 0xb9c8, 0xbc14, -0xc0ac, 0xc544, 0xc790, 0xcc28, 0xce74, 0xd0c0, -0xd30c, 0xd558 -}; -#define HANGUL_CONSONANT_CHARS_SIZE 14 -static const char16_t gHangulConsonantChars[HANGUL_CONSONANT_CHARS_SIZE] = -{ -0x3131, 0x3134, 0x3137, 0x3139, 0x3141, 0x3142, -0x3145, 0x3147, 0x3148, 0x314a, 0x314b, 0x314c, -0x314d, 0x314e -}; - -// Ge'ez set of Ethiopic ordered list. There are other locale-dependent sets. -// For the time being, let's implement two Ge'ez sets only -// per Momoi san's suggestion in bug 102252. -// For details, refer to http://www.ethiopic.org/Collation/OrderedLists.html. -#define ETHIOPIC_HALEHAME_CHARS_SIZE 26 -static const char16_t gEthiopicHalehameChars[ETHIOPIC_HALEHAME_CHARS_SIZE] = -{ -0x1200, 0x1208, 0x1210, 0x1218, 0x1220, 0x1228, -0x1230, 0x1240, 0x1260, 0x1270, 0x1280, 0x1290, -0x12a0, 0x12a8, 0x12c8, 0x12d0, 0x12d8, 0x12e8, -0x12f0, 0x1308, 0x1320, 0x1330, 0x1338, 0x1340, -0x1348, 0x1350 -}; -#define ETHIOPIC_HALEHAME_AM_CHARS_SIZE 33 -static const char16_t gEthiopicHalehameAmChars[ETHIOPIC_HALEHAME_AM_CHARS_SIZE] = -{ -0x1200, 0x1208, 0x1210, 0x1218, 0x1220, 0x1228, -0x1230, 0x1238, 0x1240, 0x1260, 0x1270, 0x1278, -0x1280, 0x1290, 0x1298, 0x12a0, 0x12a8, 0x12b8, -0x12c8, 0x12d0, 0x12d8, 0x12e0, 0x12e8, 0x12f0, -0x1300, 0x1308, 0x1320, 0x1328, 0x1330, 0x1338, -0x1340, 0x1348, 0x1350 -}; -#define ETHIOPIC_HALEHAME_TI_ER_CHARS_SIZE 31 -static const char16_t gEthiopicHalehameTiErChars[ETHIOPIC_HALEHAME_TI_ER_CHARS_SIZE] = -{ -0x1200, 0x1208, 0x1210, 0x1218, 0x1228, 0x1230, -0x1238, 0x1240, 0x1250, 0x1260, 0x1270, 0x1278, -0x1290, 0x1298, 0x12a0, 0x12a8, 0x12b8, 0x12c8, -0x12d0, 0x12d8, 0x12e0, 0x12e8, 0x12f0, 0x1300, -0x1308, 0x1320, 0x1328, 0x1330, 0x1338, 0x1348, -0x1350 -}; -#define ETHIOPIC_HALEHAME_TI_ET_CHARS_SIZE 34 -static const char16_t gEthiopicHalehameTiEtChars[ETHIOPIC_HALEHAME_TI_ET_CHARS_SIZE] = -{ -0x1200, 0x1208, 0x1210, 0x1218, 0x1220, 0x1228, -0x1230, 0x1238, 0x1240, 0x1250, 0x1260, 0x1270, -0x1278, 0x1280, 0x1290, 0x1298, 0x12a0, 0x12a8, -0x12b8, 0x12c8, 0x12d0, 0x12d8, 0x12e0, 0x12e8, -0x12f0, 0x1300, 0x1308, 0x1320, 0x1328, 0x1330, -0x1338, 0x1340, 0x1348, 0x1350 -}; - - // We know cjk-ideographic need 31 characters to display 99,999,999,999,999,999 // georgian needs 6 at most // armenian needs 12 at most @@ -696,43 +444,6 @@ static const char16_t gEthiopicHalehameTiEtChars[ETHIOPIC_HALEHAME_TI_ET_CHARS_S #define NUM_BUF_SIZE 34 -static bool CharListToText(int32_t ordinal, nsString& result, const char16_t* chars, int32_t aBase) -{ - char16_t buf[NUM_BUF_SIZE]; - int32_t idx = NUM_BUF_SIZE; - if (ordinal < 1) { - return false; - } - do { - ordinal--; // a == 0 - int32_t cur = ordinal % aBase; - buf[--idx] = chars[cur]; - ordinal /= aBase ; - } while ( ordinal > 0); - result.Append(buf+idx,NUM_BUF_SIZE-idx); - return true; -} - -static const char16_t gCJKDecimalChars[10] = -{ - 0x3007, 0x4e00, 0x4e8c, 0x4e09, 0x56db, - 0x4e94, 0x516d, 0x4e03, 0x516b, 0x4e5d -}; -static bool CharListDecimalToText(int32_t ordinal, nsString& result, const char16_t* chars) -{ - if (ordinal < 0) { - return false; - } - char16_t buf[NUM_BUF_SIZE]; - int32_t idx = NUM_BUF_SIZE; - do { - buf[--idx] = chars[ordinal % 10]; - ordinal /= 10; - } while (ordinal > 0); - result.Append(buf + idx, NUM_BUF_SIZE - idx); - return true; -} - enum CJKIdeographicLang { CHINESE, KOREAN, JAPANESE }; @@ -999,66 +710,6 @@ static bool HebrewToText(int32_t ordinal, nsString& result) return true; } - -static bool ArmenianToText(int32_t ordinal, nsString& result) -{ - if (ordinal < 1 || ordinal > 9999) { // zero or reach the limit of Armenian numbering system - return false; - } - - char16_t buf[NUM_BUF_SIZE]; - int32_t idx = NUM_BUF_SIZE; - int32_t d = 0; - do { - int32_t cur = ordinal % 10; - if (cur > 0) - { - char16_t u = 0x0530 + (d * 9) + cur; - buf[--idx] = u; - } - ++d; - ordinal /= 10; - } while (ordinal > 0); - result.Append(buf + idx, NUM_BUF_SIZE - idx); - return true; -} - - -static const char16_t gGeorgianValue [ 37 ] = { // 4 * 9 + 1 = 37 -// 1 2 3 4 5 6 7 8 9 - 0x10D0, 0x10D1, 0x10D2, 0x10D3, 0x10D4, 0x10D5, 0x10D6, 0x10F1, 0x10D7, -// 10 20 30 40 50 60 70 80 90 - 0x10D8, 0x10D9, 0x10DA, 0x10DB, 0x10DC, 0x10F2, 0x10DD, 0x10DE, 0x10DF, -// 100 200 300 400 500 600 700 800 900 - 0x10E0, 0x10E1, 0x10E2, 0x10F3, 0x10E4, 0x10E5, 0x10E6, 0x10E7, 0x10E8, -// 1000 2000 3000 4000 5000 6000 7000 8000 9000 - 0x10E9, 0x10EA, 0x10EB, 0x10EC, 0x10ED, 0x10EE, 0x10F4, 0x10EF, 0x10F0, -// 10000 - 0x10F5 -}; -static bool GeorgianToText(int32_t ordinal, nsString& result) -{ - if (ordinal < 1 || ordinal > 19999) { // zero or reach the limit of Georgian numbering system - return false; - } - - char16_t buf[NUM_BUF_SIZE]; - int32_t idx = NUM_BUF_SIZE; - int32_t d = 0; - do { - int32_t cur = ordinal % 10; - if (cur > 0) - { - char16_t u = gGeorgianValue[(d * 9 ) + ( cur - 1)]; - buf[--idx] = u; - } - ++d; - ordinal /= 10; - } while (ordinal > 0); - result.Append(buf + idx, NUM_BUF_SIZE - idx); - return true; -} - // Convert ordinal to Ethiopic numeric representation. // The detail is available at http://www.ethiopic.org/Numerals/ // The algorithm used here is based on the pseudo-code put up there by @@ -1169,109 +820,43 @@ nsBulletFrame::AppendCounterText(int32_t aListStyleType, NS_ASSERTION(success, "DecimalToText must never fail"); break; - case NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO: - success = DecimalLeadingZeroToText(aOrdinal, result); - break; - - case NS_STYLE_LIST_STYLE_CJK_DECIMAL: - success = CharListDecimalToText(aOrdinal, result, gCJKDecimalChars); - break; - - case NS_STYLE_LIST_STYLE_LOWER_ROMAN: - success = RomanToText(aOrdinal, result, - gLowerRomanCharsA, gLowerRomanCharsB); - break; - case NS_STYLE_LIST_STYLE_UPPER_ROMAN: - success = RomanToText(aOrdinal, result, - gUpperRomanCharsA, gUpperRomanCharsB); - break; - - case NS_STYLE_LIST_STYLE_LOWER_ALPHA: - success = CharListToText(aOrdinal, result, gLowerAlphaChars, ALPHA_SIZE); - break; - - case NS_STYLE_LIST_STYLE_UPPER_ALPHA: - success = CharListToText(aOrdinal, result, gUpperAlphaChars, ALPHA_SIZE); - break; - - case NS_STYLE_LIST_STYLE_KATAKANA: - success = CharListToText(aOrdinal, result, gKatakanaChars, - KATAKANA_CHARS_SIZE); - break; - - case NS_STYLE_LIST_STYLE_HIRAGANA: - success = CharListToText(aOrdinal, result, gHiraganaChars, - HIRAGANA_CHARS_SIZE); - break; - - case NS_STYLE_LIST_STYLE_KATAKANA_IROHA: - success = CharListToText(aOrdinal, result, gKatakanaIrohaChars, - KATAKANA_IROHA_CHARS_SIZE); - break; - - case NS_STYLE_LIST_STYLE_HIRAGANA_IROHA: - success = CharListToText(aOrdinal, result, gHiraganaIrohaChars, - HIRAGANA_IROHA_CHARS_SIZE); - break; - - case NS_STYLE_LIST_STYLE_LOWER_GREEK: - success = CharListToText(aOrdinal, result, gLowerGreekChars , - LOWER_GREEK_CHARS_SIZE); - break; - - case NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC: case NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_INFORMAL: - fallback = NS_STYLE_LIST_STYLE_CJK_DECIMAL; success = CJKIdeographicToText(aOrdinal, result, gDataTradChineseInformal); break; case NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_FORMAL: - fallback = NS_STYLE_LIST_STYLE_CJK_DECIMAL; success = CJKIdeographicToText(aOrdinal, result, gDataTradChineseFormal); break; case NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_INFORMAL: - fallback = NS_STYLE_LIST_STYLE_CJK_DECIMAL; success = CJKIdeographicToText(aOrdinal, result, gDataSimpChineseInformal); break; case NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_FORMAL: - fallback = NS_STYLE_LIST_STYLE_CJK_DECIMAL; success = CJKIdeographicToText(aOrdinal, result, gDataSimpChineseFormal); break; case NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_JAPANESE_INFORMAL: - fallback = NS_STYLE_LIST_STYLE_CJK_DECIMAL; success = CJKIdeographicToText(aOrdinal, result, gDataJapaneseInformal); break; case NS_STYLE_LIST_STYLE_JAPANESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_JAPANESE_FORMAL: - fallback = NS_STYLE_LIST_STYLE_CJK_DECIMAL; success = CJKIdeographicToText(aOrdinal, result, gDataJapaneseFormal); break; case NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL: - fallback = NS_STYLE_LIST_STYLE_CJK_DECIMAL; success = CJKIdeographicToText(aOrdinal, result, gDataKoreanHangulFormal); break; case NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL: - fallback = NS_STYLE_LIST_STYLE_CJK_DECIMAL; success = CJKIdeographicToText(aOrdinal, result, gDataKoreanHanjaInformal); break; case NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL: - fallback = NS_STYLE_LIST_STYLE_CJK_DECIMAL; success = CJKIdeographicToText(aOrdinal, result, gDataKoreanHanjaFormal); break; @@ -1279,120 +864,14 @@ nsBulletFrame::AppendCounterText(int32_t aListStyleType, isRTL = true; success = HebrewToText(aOrdinal, result); break; - - case NS_STYLE_LIST_STYLE_ARMENIAN: - success = ArmenianToText(aOrdinal, result); - break; - - case NS_STYLE_LIST_STYLE_GEORGIAN: - success = GeorgianToText(aOrdinal, result); - break; - - case NS_STYLE_LIST_STYLE_MOZ_ARABIC_INDIC: - success = OtherDecimalToText(aOrdinal, 0x0660, result); - break; - - case NS_STYLE_LIST_STYLE_MOZ_PERSIAN: - case NS_STYLE_LIST_STYLE_MOZ_URDU: - success = OtherDecimalToText(aOrdinal, 0x06f0, result); - break; - - case NS_STYLE_LIST_STYLE_MOZ_DEVANAGARI: - success = OtherDecimalToText(aOrdinal, 0x0966, result); - break; - - case NS_STYLE_LIST_STYLE_MOZ_GURMUKHI: - success = OtherDecimalToText(aOrdinal, 0x0a66, result); - break; - - case NS_STYLE_LIST_STYLE_MOZ_GUJARATI: - success = OtherDecimalToText(aOrdinal, 0x0AE6, result); - break; - - case NS_STYLE_LIST_STYLE_MOZ_ORIYA: - success = OtherDecimalToText(aOrdinal, 0x0B66, result); - break; - - case NS_STYLE_LIST_STYLE_MOZ_KANNADA: - success = OtherDecimalToText(aOrdinal, 0x0CE6, result); - break; - - case NS_STYLE_LIST_STYLE_MOZ_MALAYALAM: - success = OtherDecimalToText(aOrdinal, 0x0D66, result); - break; - - case NS_STYLE_LIST_STYLE_MOZ_THAI: - success = OtherDecimalToText(aOrdinal, 0x0E50, result); - break; - - case NS_STYLE_LIST_STYLE_MOZ_LAO: - success = OtherDecimalToText(aOrdinal, 0x0ED0, result); - break; - - case NS_STYLE_LIST_STYLE_MOZ_MYANMAR: - success = OtherDecimalToText(aOrdinal, 0x1040, result); - break; - - case NS_STYLE_LIST_STYLE_MOZ_KHMER: - success = OtherDecimalToText(aOrdinal, 0x17E0, result); - break; - - case NS_STYLE_LIST_STYLE_MOZ_BENGALI: - success = OtherDecimalToText(aOrdinal, 0x09E6, result); - break; - - case NS_STYLE_LIST_STYLE_MOZ_TELUGU: - success = OtherDecimalToText(aOrdinal, 0x0C66, result); - break; case NS_STYLE_LIST_STYLE_MOZ_TAMIL: success = TamilToText(aOrdinal, result); break; - case NS_STYLE_LIST_STYLE_MOZ_CJK_HEAVENLY_STEM: - fallback = NS_STYLE_LIST_STYLE_CJK_DECIMAL; - success = CharListToText(aOrdinal, result, gCJKHeavenlyStemChars, - CJK_HEAVENLY_STEM_CHARS_SIZE); - break; - - case NS_STYLE_LIST_STYLE_MOZ_CJK_EARTHLY_BRANCH: - fallback = NS_STYLE_LIST_STYLE_CJK_DECIMAL; - success = CharListToText(aOrdinal, result, gCJKEarthlyBranchChars, - CJK_EARTHLY_BRANCH_CHARS_SIZE); - break; - - case NS_STYLE_LIST_STYLE_MOZ_HANGUL: - success = CharListToText(aOrdinal, result, gHangulChars, HANGUL_CHARS_SIZE); - break; - - case NS_STYLE_LIST_STYLE_MOZ_HANGUL_CONSONANT: - success = CharListToText(aOrdinal, result, gHangulConsonantChars, - HANGUL_CONSONANT_CHARS_SIZE); - break; - - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME: - success = CharListToText(aOrdinal, result, gEthiopicHalehameChars, - ETHIOPIC_HALEHAME_CHARS_SIZE); - break; - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_NUMERIC: success = EthiopicToText(aOrdinal, result); break; - - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_AM: - success = CharListToText(aOrdinal, result, gEthiopicHalehameAmChars, - ETHIOPIC_HALEHAME_AM_CHARS_SIZE); - break; - - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ER: - success = CharListToText(aOrdinal, result, gEthiopicHalehameTiErChars, - ETHIOPIC_HALEHAME_TI_ER_CHARS_SIZE); - break; - - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ET: - success = CharListToText(aOrdinal, result, gEthiopicHalehameTiEtChars, - ETHIOPIC_HALEHAME_TI_ET_CHARS_SIZE); - break; } if (!success) { AppendCounterText(fallback, aOrdinal, result, isRTL); @@ -1413,30 +892,18 @@ nsBulletFrame::GetListItemSuffix(int32_t aListStyleType, aResult = ' '; break; - case NS_STYLE_LIST_STYLE_CJK_DECIMAL: - case NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC: case NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL: case NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL: case NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL: case NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL: case NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL: case NS_STYLE_LIST_STYLE_JAPANESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_JAPANESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_JAPANESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_CJK_HEAVENLY_STEM: - case NS_STYLE_LIST_STYLE_MOZ_CJK_EARTHLY_BRANCH: aResult = 0x3001; break; case NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL: case NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL: case NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_HANGUL: - case NS_STYLE_LIST_STYLE_MOZ_HANGUL_CONSONANT: aResult.AssignLiteral(MOZ_UTF16(", ")); break; } diff --git a/layout/style/CounterStyleManager.cpp b/layout/style/CounterStyleManager.cpp index 5e4cc222c53..b3b1e57f3e4 100644 --- a/layout/style/CounterStyleManager.cpp +++ b/layout/style/CounterStyleManager.cpp @@ -327,8 +327,6 @@ BuiltinCounterStyle::GetNegative(NegativeType& aResult) switch (mStyle) { case NS_STYLE_LIST_STYLE_JAPANESE_FORMAL: case NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_JAPANESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_JAPANESE_INFORMAL: aResult.before = gJapaneseNegative; break; @@ -340,16 +338,11 @@ BuiltinCounterStyle::GetNegative(NegativeType& aResult) case NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL: case NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_INFORMAL: aResult.before = gSimpChineseNegative; break; - case NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC: case NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL: case NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_INFORMAL: aResult.before = gTradChineseNegative; break; @@ -371,9 +364,7 @@ BuiltinCounterStyle::IsOrdinalInRange(CounterValue aOrdinal) case NS_STYLE_LIST_STYLE_SQUARE: // use DecimalToText case NS_STYLE_LIST_STYLE_DECIMAL: - case NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO: // use CJKIdeographicToText - case NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC: case NS_STYLE_LIST_STYLE_JAPANESE_FORMAL: case NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL: case NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL: @@ -383,55 +374,8 @@ BuiltinCounterStyle::IsOrdinalInRange(CounterValue aOrdinal) case NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL: case NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL: case NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_JAPANESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_JAPANESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_INFORMAL: - // use OtherDecimalToText - case NS_STYLE_LIST_STYLE_MOZ_ARABIC_INDIC: - case NS_STYLE_LIST_STYLE_MOZ_PERSIAN: - case NS_STYLE_LIST_STYLE_MOZ_URDU: - case NS_STYLE_LIST_STYLE_MOZ_DEVANAGARI: - case NS_STYLE_LIST_STYLE_MOZ_GURMUKHI: - case NS_STYLE_LIST_STYLE_MOZ_GUJARATI: - case NS_STYLE_LIST_STYLE_MOZ_ORIYA: - case NS_STYLE_LIST_STYLE_MOZ_KANNADA: - case NS_STYLE_LIST_STYLE_MOZ_MALAYALAM: - case NS_STYLE_LIST_STYLE_MOZ_THAI: - case NS_STYLE_LIST_STYLE_MOZ_LAO: - case NS_STYLE_LIST_STYLE_MOZ_MYANMAR: - case NS_STYLE_LIST_STYLE_MOZ_KHMER: - case NS_STYLE_LIST_STYLE_MOZ_BENGALI: - case NS_STYLE_LIST_STYLE_MOZ_TELUGU: return true; - // use CharListDecimalToText - case NS_STYLE_LIST_STYLE_CJK_DECIMAL: - return aOrdinal >= 0; - - // use RomanToText - case NS_STYLE_LIST_STYLE_LOWER_ROMAN: - case NS_STYLE_LIST_STYLE_UPPER_ROMAN: - return aOrdinal >= 1 && aOrdinal <= 3999; - - // use CharListToText - case NS_STYLE_LIST_STYLE_LOWER_ALPHA: - case NS_STYLE_LIST_STYLE_UPPER_ALPHA: - case NS_STYLE_LIST_STYLE_KATAKANA: - case NS_STYLE_LIST_STYLE_HIRAGANA: - case NS_STYLE_LIST_STYLE_KATAKANA_IROHA: - case NS_STYLE_LIST_STYLE_HIRAGANA_IROHA: - case NS_STYLE_LIST_STYLE_LOWER_GREEK: - case NS_STYLE_LIST_STYLE_MOZ_CJK_HEAVENLY_STEM: - case NS_STYLE_LIST_STYLE_MOZ_CJK_EARTHLY_BRANCH: - case NS_STYLE_LIST_STYLE_MOZ_HANGUL: - case NS_STYLE_LIST_STYLE_MOZ_HANGUL_CONSONANT: - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME: - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_AM: - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ER: - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ET: // use EthiopicToText case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_NUMERIC: return aOrdinal >= 1; @@ -440,15 +384,9 @@ BuiltinCounterStyle::IsOrdinalInRange(CounterValue aOrdinal) case NS_STYLE_LIST_STYLE_HEBREW: return aOrdinal >= 1 && aOrdinal <= 999999; - // use ArmenianToText - case NS_STYLE_LIST_STYLE_ARMENIAN: // use TamilToText case NS_STYLE_LIST_STYLE_MOZ_TAMIL: return aOrdinal >= 1 && aOrdinal <= 9999; - - // use GeorgianToText - case NS_STYLE_LIST_STYLE_GEORGIAN: - return aOrdinal >= 1 && aOrdinal <= 19999; } } @@ -463,55 +401,13 @@ BuiltinCounterStyle::IsOrdinalInAutoRange(CounterValue aOrdinal) case NS_STYLE_LIST_STYLE_SQUARE: // numeric: case NS_STYLE_LIST_STYLE_DECIMAL: - case NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO: - case NS_STYLE_LIST_STYLE_CJK_DECIMAL: - case NS_STYLE_LIST_STYLE_MOZ_ARABIC_INDIC: - case NS_STYLE_LIST_STYLE_MOZ_PERSIAN: - case NS_STYLE_LIST_STYLE_MOZ_URDU: - case NS_STYLE_LIST_STYLE_MOZ_DEVANAGARI: - case NS_STYLE_LIST_STYLE_MOZ_GURMUKHI: - case NS_STYLE_LIST_STYLE_MOZ_GUJARATI: - case NS_STYLE_LIST_STYLE_MOZ_ORIYA: - case NS_STYLE_LIST_STYLE_MOZ_KANNADA: - case NS_STYLE_LIST_STYLE_MOZ_MALAYALAM: - case NS_STYLE_LIST_STYLE_MOZ_THAI: - case NS_STYLE_LIST_STYLE_MOZ_LAO: - case NS_STYLE_LIST_STYLE_MOZ_MYANMAR: - case NS_STYLE_LIST_STYLE_MOZ_KHMER: - case NS_STYLE_LIST_STYLE_MOZ_BENGALI: - case NS_STYLE_LIST_STYLE_MOZ_TELUGU: - // fixed: no predefined counter style return true; - // alphabetic: - case NS_STYLE_LIST_STYLE_LOWER_ALPHA: - case NS_STYLE_LIST_STYLE_UPPER_ALPHA: - case NS_STYLE_LIST_STYLE_LOWER_GREEK: - case NS_STYLE_LIST_STYLE_KATAKANA: - case NS_STYLE_LIST_STYLE_HIRAGANA: - case NS_STYLE_LIST_STYLE_KATAKANA_IROHA: - case NS_STYLE_LIST_STYLE_HIRAGANA_IROHA: - case NS_STYLE_LIST_STYLE_MOZ_CJK_HEAVENLY_STEM: - case NS_STYLE_LIST_STYLE_MOZ_CJK_EARTHLY_BRANCH: - case NS_STYLE_LIST_STYLE_MOZ_HANGUL: - case NS_STYLE_LIST_STYLE_MOZ_HANGUL_CONSONANT: - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME: - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_AM: - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ER: - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ET: - // symbolic: no predefined counter style - return aOrdinal >= 1; - // additive: - case NS_STYLE_LIST_STYLE_LOWER_ROMAN: - case NS_STYLE_LIST_STYLE_UPPER_ROMAN: - case NS_STYLE_LIST_STYLE_ARMENIAN: - case NS_STYLE_LIST_STYLE_GEORGIAN: case NS_STYLE_LIST_STYLE_HEBREW: return aOrdinal >= 0; // complex predefined: - case NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC: case NS_STYLE_LIST_STYLE_JAPANESE_FORMAL: case NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL: case NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL: @@ -521,12 +417,6 @@ BuiltinCounterStyle::IsOrdinalInAutoRange(CounterValue aOrdinal) case NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL: case NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL: case NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_JAPANESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_JAPANESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_INFORMAL: - case NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_FORMAL: - case NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_INFORMAL: case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_NUMERIC: case NS_STYLE_LIST_STYLE_MOZ_TAMIL: return IsOrdinalInRange(aOrdinal); @@ -540,16 +430,8 @@ BuiltinCounterStyle::IsOrdinalInAutoRange(CounterValue aOrdinal) /* virtual */ void BuiltinCounterStyle::GetPad(PadType& aResult) { - switch (mStyle) { - case NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO: - aResult.width = 2; - aResult.symbol.AssignLiteral(MOZ_UTF16("0")); - break; - default: - aResult.width = 0; - aResult.symbol.Truncate(); - break; - } + aResult.width = 0; + aResult.symbol.Truncate(); } /* virtual */ CounterStyle* @@ -569,14 +451,6 @@ BuiltinCounterStyle::GetSpeakAs() case NS_STYLE_LIST_STYLE_CIRCLE: case NS_STYLE_LIST_STYLE_SQUARE: return NS_STYLE_COUNTER_SPEAKAS_BULLETS; - case NS_STYLE_LIST_STYLE_LOWER_ALPHA: - case NS_STYLE_LIST_STYLE_UPPER_ALPHA: - case NS_STYLE_LIST_STYLE_KATAKANA: - case NS_STYLE_LIST_STYLE_HIRAGANA: - case NS_STYLE_LIST_STYLE_KATAKANA_IROHA: - case NS_STYLE_LIST_STYLE_HIRAGANA_IROHA: - case NS_STYLE_LIST_STYLE_LOWER_GREEK: - return NS_STYLE_COUNTER_SPEAKAS_SPELL_OUT; default: return NS_STYLE_COUNTER_SPEAKAS_NUMBERS; } @@ -1546,6 +1420,11 @@ CounterStyleManager::GetBuiltinStyle(int32_t aStyle) "Require a valid builtin style constant"); NS_ABORT_IF_FALSE(!gBuiltinStyleTable[aStyle].IsDependentStyle(), "Cannot get dependent builtin style"); + NS_ASSERTION(aStyle != NS_STYLE_LIST_STYLE_LOWER_ROMAN && + aStyle != NS_STYLE_LIST_STYLE_UPPER_ROMAN && + aStyle != NS_STYLE_LIST_STYLE_LOWER_ALPHA && + aStyle != NS_STYLE_LIST_STYLE_UPPER_ALPHA, + "lower/upper-roman/alpha should be custom counter style"); return &gBuiltinStyleTable[aStyle]; } diff --git a/layout/style/counterstyles.css b/layout/style/counterstyles.css new file mode 100644 index 00000000000..3b0f0f9c627 --- /dev/null +++ b/layout/style/counterstyles.css @@ -0,0 +1,265 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* Defined in CSS Counter Styles Level 3 */ + +/* 6 Simple Predefined Counter Styles */ + +/* 6.1 Numeric */ + +@counter-style decimal-leading-zero { + system: extends decimal; + pad: 2 '0'; +} + +@counter-style cjk-decimal { + system: numeric; + range: 0 infinite; + symbols: \3007 \4E00 \4E8C \4E09 \56DB \4E94 \516D \4E03 \516B \4E5D; + suffix: '\3001'; +} + +/* Though {lower,upper}-roman have been defined as builtin styles, they + * are redefined here to allow the correct extending behavior. */ + +@counter-style lower-roman { + system: additive; + range: 1 3999; + additive-symbols: 1000 m, 900 cm, 500 d, 400 cd, 100 c, 90 xc, 50 l, 40 xl, 10 x, 9 ix, 5 v, 4 iv, 1 i; +} + +@counter-style upper-roman { + system: additive; + range: 1 3999; + additive-symbols: 1000 M, 900 CM, 500 D, 400 CD, 100 C, 90 XC, 50 L, 40 XL, 10 X, 9 IX, 5 V, 4 IV, 1 I; +} + +@counter-style armenian { + system: additive; + range: 1 9999; + additive-symbols: 9000 \554, 8000 \553, 7000 \552, 6000 \551, 5000 \550, 4000 \54F, 3000 \54E, 2000 \54D, 1000 \54C, 900 \54B, 800 \54A, 700 \549, 600 \548, 500 \547, 400 \546, 300 \545, 200 \544, 100 \543, 90 \542, 80 \541, 70 \540, 60 \53F, 50 \53E, 40 \53D, 30 \53C, 20 \53B, 10 \53A, 9 \539, 8 \538, 7 \537, 6 \536, 5 \535, 4 \534, 3 \533, 2 \532, 1 \531; +} + +@counter-style georgian { + system: additive; + range: 1 19999; + additive-symbols: 10000 \10F5, 9000 \10F0, 8000 \10EF, 7000 \10F4, 6000 \10EE, 5000 \10ED, 4000 \10EC, 3000 \10EB, 2000 \10EA, 1000 \10E9, 900 \10E8, 800 \10E7, 700 \10E6, 600 \10E5, 500 \10E4, 400 \10F3, 300 \10E2, 200 \10E1, 100 \10E0, 90 \10DF, 80 \10DE, 70 \10DD, 60 \10F2, 50 \10DC, 40 \10DB, 30 \10DA, 20 \10D9, 10 \10D8, 9 \10D7, 8 \10F1, 7 \10D6, 6 \10D5, 5 \10D4, 4 \10D3, 3 \10D2, 2 \10D1, 1 \10D0; +} + +/* hebrew is not included because our builtin algorithm can generate a wider + * range of number in this style than what the spec defines. */ + +/* 6.2 Alphabetic */ + +@counter-style lower-alpha { + system: alphabetic; + symbols: a b c d e f g h i j k l m n o p q r s t u v w x y z; +} + +@counter-style lower-latin { + system: extends lower-alpha; +} + +@counter-style upper-alpha { + system: alphabetic; + symbols: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z; +} + +@counter-style upper-latin { + system: extends upper-alpha; +} + +@counter-style lower-greek { + system: alphabetic; + symbols: \3B1 \3B2 \3B3 \3B4 \3B5 \3B6 \3B7 \3B8 \3B9 \3BA \3BB \3BC \3BD \3BE \3BF \3C0 \3C1 \3C3 \3C4 \3C5 \3C6 \3C7 \3C8 \3C9; +} + +@counter-style hiragana { + system: alphabetic; + symbols: \3042 \3044 \3046 \3048 \304A \304B \304D \304F \3051 \3053 \3055 \3057 \3059 \305B \305D \305F \3061 \3064 \3066 \3068 \306A \306B \306C \306D \306E \306F \3072 \3075 \3078 \307B \307E \307F \3080 \3081 \3082 \3084 \3086 \3088 \3089 \308A \308B \308C \308D \308F \3090 \3091 \3092 \3093; + suffix: '\3001'; +} + +@counter-style hiragana-iroha { + system: alphabetic; + symbols: \3044 \308D \306F \306B \307B \3078 \3068 \3061 \308A \306C \308B \3092 \308F \304B \3088 \305F \308C \305D \3064 \306D \306A \3089 \3080 \3046 \3090 \306E \304A \304F \3084 \307E \3051 \3075 \3053 \3048 \3066 \3042 \3055 \304D \3086 \3081 \307F \3057 \3091 \3072 \3082 \305B \3059; + suffix: '\3001'; +} + +@counter-style katakana { + system: alphabetic; + symbols: \30A2 \30A4 \30A6 \30A8 \30AA \30AB \30AD \30AF \30B1 \30B3 \30B5 \30B7 \30B9 \30BB \30BD \30BF \30C1 \30C4 \30C6 \30C8 \30CA \30CB \30CC \30CD \30CE \30CF \30D2 \30D5 \30D8 \30DB \30DE \30DF \30E0 \30E1 \30E2 \30E4 \30E6 \30E8 \30E9 \30EA \30EB \30EC \30ED \30EF \30F0 \30F1 \30F2 \30F3; + suffix: '\3001'; +} + +@counter-style katakana-iroha { + system: alphabetic; + symbols: \30A4 \30ED \30CF \30CB \30DB \30D8 \30C8 \30C1 \30EA \30CC \30EB \30F2 \30EF \30AB \30E8 \30BF \30EC \30BD \30C4 \30CD \30CA \30E9 \30E0 \30A6 \30F0 \30CE \30AA \30AF \30E4 \30DE \30B1 \30D5 \30B3 \30A8 \30C6 \30A2 \30B5 \30AD \30E6 \30E1 \30DF \30B7 \30F1 \30D2 \30E2 \30BB \30B9; + suffix: '\3001'; +} + +/* 6.3 Symbolic */ + +/* symbolic counter styles are not included because they will be drew directly + * by the program instead of use alternative symbols defined in the spec */ + +/* 7 Complex Predefined Counter Styles */ + +/* only alias is included as other complex counter styles will be generated by + * specific algorithms to support the extended range. */ + +@counter-style cjk-ideographic { + system: extends trad-chinese-informal; +} + +/* Mozilla-specific counter styles */ + +/* Numeric */ + +@counter-style -moz-arabic-indic { + system: numeric; + symbols: \660 \661 \662 \663 \664 \665 \666 \667 \668 \669; +} + +@counter-style -moz-persian { + system: numeric; + symbols: \6F0 \6F1 \6F2 \6F3 \6F4 \6F5 \6F6 \6F7 \6F8 \6F9; +} + +@counter-style -moz-urdu { + system: extends -moz-persian; +} + +@counter-style -moz-devanagari { + system: numeric; + symbols: \966 \967 \968 \969 \96A \96B \96C \96D \96F \970; +} + +@counter-style -moz-bengali { + system: numeric; + symbols: \9E6 \9E7 \9E8 \9E9 \9EA \9EB \9EC \9ED \9EF \9F0; +} + +@counter-style -moz-gurmukhi { + system: numeric; + symbols: \A66 \A67 \A68 \A69 \A6A \A6B \A6C \A6D \A6F \A70; +} + +@counter-style -moz-gujarati { + system: numeric; + symbols: \AE6 \AE7 \AE8 \AE9 \AEA \AEB \AEC \AED \AEF \AF0; +} + +@counter-style -moz-oriya { + system: numeric; + symbols: \B66 \B67 \B68 \B69 \B6A \B6B \B6C \B6D \B6F \B70; +} + +@counter-style -moz-telugu { + system: numeric; + symbols: \C66 \C67 \C68 \C69 \C6A \C6B \C6C \C6D \C6F \C70; +} + +@counter-style -moz-kannada { + system: numeric; + symbols: \CE6 \CE7 \CE8 \CE9 \CEA \CEB \CEC \CED \CEF \CF0; +} + +@counter-style -moz-malayalam { + system: numeric; + symbols: \D66 \D67 \D68 \D69 \D6A \D6B \D6C \D6D \D6F \D70; +} + +@counter-style -moz-thai { + system: numeric; + symbols: \E50 \E51 \E52 \E53 \E54 \E55 \E56 \E57 \E58 \E59; +} + +@counter-style -moz-lao { + system: numeric; + symbols: \ED0 \ED1 \ED2 \ED3 \ED4 \ED5 \ED6 \ED7 \ED8 \ED9; +} + +@counter-style -moz-myanmar { + system: numeric; + symbols: \1040 \1041 \1042 \1043 \1044 \1045 \1046 \1047 \1048 \1049; +} + +@counter-style -moz-khmer { + system: numeric; + symbols: \17E0 \17E1 \17E2 \17E3 \17E4 \17E5 \17E6 \17E7 \17E8 \17E9; +} + +/* Alphabetic */ + +@counter-style -moz-cjk-heavenly-stem { + system: alphabetic; + symbols: \7532 \4E59 \4E19 \4E01 \620A \5DF1 \5E9A \8F9B \58EC \7678; + fallback: cjk-decimal; + suffix: '\3001'; +} +@counter-style -moz-cjk-earthly-branch { + system: alphabetic; + symbols: \5B50 \4E11 \5BC5 \536F \8FB0 \5DF3 \5348 \672A \7533 \9149 \620C \4EA5; + fallback: cjk-decimal; + suffix: '\3001'; +} + +@counter-style -moz-hangul { + system: alphabetic; + symbols: \AC00 \B098 \B2E4 \B77C \B9C8 \BC14 \C0AC \C544 \C790 \CC28 \CE74 \D0C0 \D30C \D558; + suffix: ','; +} +@counter-style -moz-hangul-consonant { + system: alphabetic; + symbols: \3131 \3134 \3137 \3139 \3141 \3142 \3145 \3147 \3148 \314A \314B \314C \314D \314E; + suffix: ','; +} + +/* Ge'ez set of Ethiopic ordered list. There are other locale-dependent sets. + * For the time being, let's implement two Ge'ez sets only + * per Momoi san's suggestion in bug 102252. + * For details, refer to http://www.ethiopic.org/Collation/OrderedLists.html. */ +@counter-style -moz-ethiopic-halehame { + system: alphabetic; + symbols: \1200 \1208 \1210 \1218 \1220 \1228 \1230 \1240 \1260 \1270 \1280 \1290 \12A0 \12A8 \12C8 \12D0 \12D8 \12E8 \12F0 \1308 \1320 \1330 \1338 \1340 \1348 \1350; +} +@counter-style -moz-ethiopic-halehame-am { + system: alphabetic; + symbols: \1200 \1208 \1210 \1218 \1220 \1228 \1230 \1238 \1240 \1260 \1270 \1278 \1280 \1290 \1298 \12A0 \12A8 \12B8 \12C8 \12D0 \12D8 \12E0 \12E8 \12F0 \1300 \1308 \1320 \1328 \1330 \1338 \1340 \1348 \1350; +} +@counter-style -moz-ethiopic-halehame-ti-er { + system: alphabetic; + symbols: \1200 \1208 \1210 \1218 \1228 \1230 \1238 \1240 \1250 \1260 \1270 \1278 \1290 \1298 \12A0 \12A8 \12B8 \12C8 \12D0 \12D8 \12E0 \12E8 \12F0 \1300 \1308 \1320 \1328 \1330 \1338 \1348 \1350; +} +@counter-style -moz-ethiopic-halehame-ti-et { + system: alphabetic; + symbols: \1200 \1208 \1210 \1218 \1220 \1228 \1230 \1238 \1240 \1250 \1260 \1270 \1278 \1280 \1290 \1298 \12A0 \12A8 \12B8 \12C8 \12D0 \12D8 \12E0 \12E8 \12F0 \1300 \1308 \1320 \1328 \1330 \1338 \1340 \1348 \1350; +} + +/* Alias */ + +@counter-style -moz-trad-chinese-informal { + system: extends trad-chinese-informal; +} + +@counter-style -moz-trad-chinese-formal { + system: extends trad-chinese-formal; +} + +@counter-style -moz-simp-chinese-informal { + system: extends simp-chinese-informal; +} + +@counter-style -moz-simp-chinese-formal { + system: extends simp-chinese-formal; +} + +@counter-style -moz-japanese-informal { + system: extends japanese-informal; +} + +@counter-style -moz-japanese-formal { + system: extends japanese-formal; +} diff --git a/layout/style/jar.mn b/layout/style/jar.mn index 4bef7cebd21..3d10bce75a5 100644 --- a/layout/style/jar.mn +++ b/layout/style/jar.mn @@ -9,6 +9,7 @@ toolkit.jar: res/full-screen-override.css (full-screen-override.css) res/plaintext.css (plaintext.css) res/viewsource.css (viewsource.css) + res/counterstyles.css (counterstyles.css) * res/forms.css (forms.css) res/number-control.css (number-control.css) res/arrow.gif (arrow.gif) diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h index a40f9c13640..55af75fcaf4 100644 --- a/layout/style/nsCSSKeywordList.h +++ b/layout/style/nsCSSKeywordList.h @@ -39,9 +39,7 @@ CSS_KEY(-moz-activehyperlinktext, _moz_activehyperlinktext) CSS_KEY(-moz-all, _moz_all) CSS_KEY(-moz-alt-content, _moz_alt_content) CSS_KEY(-moz-anchor-decoration, _moz_anchor_decoration) -CSS_KEY(-moz-arabic-indic, _moz_arabic_indic) CSS_KEY(-moz-available, _moz_available) -CSS_KEY(-moz-bengali, _moz_bengali) CSS_KEY(-moz-box, _moz_box) CSS_KEY(-moz-button, _moz_button) CSS_KEY(-moz-buttondefault, _moz_buttondefault) @@ -50,8 +48,6 @@ CSS_KEY(-moz-buttonhovertext, _moz_buttonhovertext) CSS_KEY(-moz-cellhighlight, _moz_cellhighlight) CSS_KEY(-moz-cellhighlighttext, _moz_cellhighlighttext) CSS_KEY(-moz-center, _moz_center) -CSS_KEY(-moz-cjk-earthly-branch, _moz_cjk_earthly_branch) -CSS_KEY(-moz-cjk-heavenly-stem, _moz_cjk_heavenly_stem) CSS_KEY(-moz-combobox, _moz_combobox) CSS_KEY(-moz-comboboxtext, _moz_comboboxtext) CSS_KEY(-moz-block-height, _moz_block_height) @@ -59,18 +55,13 @@ CSS_KEY(-moz-deck, _moz_deck) CSS_KEY(-moz-default-background-color, _moz_default_background_color) CSS_KEY(-moz-default-color, _moz_default_color) CSS_KEY(-moz-desktop, _moz_desktop) -CSS_KEY(-moz-devanagari, _moz_devanagari) CSS_KEY(-moz-dialog, _moz_dialog) CSS_KEY(-moz-dialogtext, _moz_dialogtext) CSS_KEY(-moz-document, _moz_document) CSS_KEY(-moz-dragtargetzone, _moz_dragtargetzone) CSS_KEY(-moz-element, _moz_element) CSS_KEY(-moz-eventreerow, _moz_eventreerow) -CSS_KEY(-moz-ethiopic-halehame, _moz_ethiopic_halehame) CSS_KEY(-moz-ethiopic-numeric, _moz_ethiopic_numeric) -CSS_KEY(-moz-ethiopic-halehame-am, _moz_ethiopic_halehame_am) -CSS_KEY(-moz-ethiopic-halehame-ti-er, _moz_ethiopic_halehame_ti_er) -CSS_KEY(-moz-ethiopic-halehame-ti-et, _moz_ethiopic_halehame_ti_et) CSS_KEY(-moz-field, _moz_field) CSS_KEY(-moz-fieldtext, _moz_fieldtext) CSS_KEY(-moz-fit-content, _moz_fit_content) @@ -81,11 +72,7 @@ CSS_KEY(-moz-grid-group, _moz_grid_group) CSS_KEY(-moz-grid-line, _moz_grid_line) CSS_KEY(-moz-grid, _moz_grid) CSS_KEY(-moz-groupbox, _moz_groupbox) -CSS_KEY(-moz-gujarati, _moz_gujarati) -CSS_KEY(-moz-gurmukhi, _moz_gurmukhi) -CSS_KEY(-moz-hangul-consonant, _moz_hangul_consonant) CSS_KEY(-moz-hidden-unscrollable, _moz_hidden_unscrollable) -CSS_KEY(-moz-hangul, _moz_hangul) CSS_KEY(-moz-hyperlinktext, _moz_hyperlinktext) CSS_KEY(-moz-html-cellhighlight, _moz_html_cellhighlight) CSS_KEY(-moz-html-cellhighlighttext, _moz_html_cellhighlighttext) @@ -96,11 +83,6 @@ CSS_KEY(-moz-inline-grid, _moz_inline_grid) CSS_KEY(-moz-inline-stack, _moz_inline_stack) CSS_KEY(-moz-isolate, _moz_isolate) CSS_KEY(-moz-isolate-override, _moz_isolate_override) -CSS_KEY(-moz-japanese-formal, _moz_japanese_formal) -CSS_KEY(-moz-japanese-informal, _moz_japanese_informal) -CSS_KEY(-moz-kannada, _moz_kannada) -CSS_KEY(-moz-khmer, _moz_khmer) -CSS_KEY(-moz-lao, _moz_lao) CSS_KEY(-moz-left, _moz_left) CSS_KEY(-moz-list, _moz_list) CSS_KEY(-moz-mac-chrome-active, _moz_mac_chrome_active) @@ -113,7 +95,6 @@ CSS_KEY(-moz-mac-menutextdisable, _moz_mac_menutextdisable) CSS_KEY(-moz-mac-menutextselect, _moz_mac_menutextselect) CSS_KEY(-moz-mac-disabledtoolbartext, _moz_mac_disabledtoolbartext) CSS_KEY(-moz-mac-secondaryhighlight, _moz_mac_secondaryhighlight) -CSS_KEY(-moz-malayalam, _moz_malayalam) CSS_KEY(-moz-max-content, _moz_max_content) CSS_KEY(-moz-menuhover, _moz_menuhover) CSS_KEY(-moz-menuhovertext, _moz_menuhovertext) @@ -121,12 +102,9 @@ CSS_KEY(-moz-menubartext, _moz_menubartext) CSS_KEY(-moz-menubarhovertext, _moz_menubarhovertext) CSS_KEY(-moz-middle-with-baseline, _moz_middle_with_baseline) CSS_KEY(-moz-min-content, _moz_min_content) -CSS_KEY(-moz-myanmar, _moz_myanmar) CSS_KEY(-moz-nativehyperlinktext, _moz_nativehyperlinktext) CSS_KEY(-moz-none, _moz_none) CSS_KEY(-moz-oddtreerow, _moz_oddtreerow) -CSS_KEY(-moz-oriya, _moz_oriya) -CSS_KEY(-moz-persian, _moz_persian) CSS_KEY(-moz-plaintext, _moz_plaintext) CSS_KEY(-moz-popup, _moz_popup) CSS_KEY(-moz-pre-space, _moz_pre_space) @@ -136,15 +114,8 @@ CSS_KEY(-moz-scrollbars-horizontal, _moz_scrollbars_horizontal) CSS_KEY(-moz-scrollbars-none, _moz_scrollbars_none) CSS_KEY(-moz-scrollbars-vertical, _moz_scrollbars_vertical) CSS_KEY(-moz-show-background, _moz_show_background) -CSS_KEY(-moz-simp-chinese-formal, _moz_simp_chinese_formal) -CSS_KEY(-moz-simp-chinese-informal, _moz_simp_chinese_informal) CSS_KEY(-moz-stack, _moz_stack) CSS_KEY(-moz-tamil, _moz_tamil) -CSS_KEY(-moz-telugu, _moz_telugu) -CSS_KEY(-moz-thai, _moz_thai) -CSS_KEY(-moz-trad-chinese-formal, _moz_trad_chinese_formal) -CSS_KEY(-moz-trad-chinese-informal, _moz_trad_chinese_informal) -CSS_KEY(-moz-urdu, _moz_urdu) CSS_KEY(-moz-use-system-font, _moz_use_system_font) CSS_KEY(-moz-use-text-color, _moz_use_text_color) CSS_KEY(-moz-visitedhyperlinktext, _moz_visitedhyperlinktext) @@ -168,7 +139,6 @@ CSS_KEY(alternate-reverse, alternate_reverse) CSS_KEY(always, always) CSS_KEY(annotation, annotation) CSS_KEY(appworkspace, appworkspace) -CSS_KEY(armenian, armenian) CSS_KEY(auto, auto) CSS_KEY(avoid, avoid) CSS_KEY(background, background) @@ -208,7 +178,6 @@ CSS_KEY(ch, ch) CSS_KEY(character-variant, character_variant) CSS_KEY(circle, circle) CSS_KEY(cjk-decimal, cjk_decimal) -CSS_KEY(cjk-ideographic, cjk_ideographic) CSS_KEY(clip, clip) CSS_KEY(clone, clone) CSS_KEY(close-quote, close_quote) @@ -247,7 +216,6 @@ CSS_KEY(darken, darken) CSS_KEY(dashed, dashed) CSS_KEY(dense, dense) CSS_KEY(decimal, decimal) -CSS_KEY(decimal-leading-zero, decimal_leading_zero) CSS_KEY(default, default) CSS_KEY(deg, deg) CSS_KEY(diagonal-fractions, diagonal_fractions) @@ -295,7 +263,6 @@ CSS_KEY(forwards, forwards) CSS_KEY(fraktur, fraktur) CSS_KEY(from-image, from_image) CSS_KEY(full-width, full_width) -CSS_KEY(georgian, georgian) CSS_KEY(grab, grab) CSS_KEY(grabbing, grabbing) CSS_KEY(grad, grad) @@ -310,8 +277,6 @@ CSS_KEY(hidden, hidden) CSS_KEY(hide, hide) CSS_KEY(highlight, highlight) CSS_KEY(highlighttext, highlighttext) -CSS_KEY(hiragana, hiragana) -CSS_KEY(hiragana-iroha, hiragana_iroha) CSS_KEY(historical-forms, historical_forms) CSS_KEY(historical-ligatures, historical_ligatures) CSS_KEY(horizontal, horizontal) @@ -350,8 +315,6 @@ CSS_KEY(jis83, jis83) CSS_KEY(jis90, jis90) CSS_KEY(jis04, jis04) CSS_KEY(justify, justify) -CSS_KEY(katakana, katakana) -CSS_KEY(katakana-iroha, katakana_iroha) CSS_KEY(keep-all, keep_all) CSS_KEY(khz, khz) CSS_KEY(korean-hangul-formal, korean_hangul_formal) @@ -371,8 +334,6 @@ CSS_KEY(local, local) CSS_KEY(logical, logical) CSS_KEY(looped, looped) CSS_KEY(lower-alpha, lower_alpha) -CSS_KEY(lower-greek, lower_greek) -CSS_KEY(lower-latin, lower_latin) CSS_KEY(lower-roman, lower_roman) CSS_KEY(lowercase, lowercase) CSS_KEY(ltr, ltr) @@ -580,7 +541,6 @@ CSS_KEY(underline, underline) CSS_KEY(unicase, unicase) CSS_KEY(unset, unset) CSS_KEY(upper-alpha, upper_alpha) -CSS_KEY(upper-latin, upper_latin) CSS_KEY(upper-roman, upper_roman) CSS_KEY(uppercase, uppercase) CSS_KEY(upright, upright) diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 9e4d1023b93..a1cae2ffec7 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -1362,28 +1362,20 @@ const KTableValue nsCSSProps::kListStylePositionKTable[] = { }; const KTableValue nsCSSProps::kListStyleKTable[] = { + // none and decimal are not redefinable, so they should not be moved. eCSSKeyword_none, NS_STYLE_LIST_STYLE_NONE, + eCSSKeyword_decimal, NS_STYLE_LIST_STYLE_DECIMAL, + // the following graphic styles are processed in a different way. eCSSKeyword_disc, NS_STYLE_LIST_STYLE_DISC, eCSSKeyword_circle, NS_STYLE_LIST_STYLE_CIRCLE, eCSSKeyword_square, NS_STYLE_LIST_STYLE_SQUARE, - eCSSKeyword_decimal, NS_STYLE_LIST_STYLE_DECIMAL, - eCSSKeyword_decimal_leading_zero, NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO, + // {lower,upper}-{roman,alpha} are also used by html attribute map. eCSSKeyword_lower_roman, NS_STYLE_LIST_STYLE_LOWER_ROMAN, eCSSKeyword_upper_roman, NS_STYLE_LIST_STYLE_UPPER_ROMAN, - eCSSKeyword_lower_greek, NS_STYLE_LIST_STYLE_LOWER_GREEK, eCSSKeyword_lower_alpha, NS_STYLE_LIST_STYLE_LOWER_ALPHA, - eCSSKeyword_lower_latin, NS_STYLE_LIST_STYLE_LOWER_LATIN, eCSSKeyword_upper_alpha, NS_STYLE_LIST_STYLE_UPPER_ALPHA, - eCSSKeyword_upper_latin, NS_STYLE_LIST_STYLE_UPPER_LATIN, + // the following counter styles require specific algorithms to generate. eCSSKeyword_hebrew, NS_STYLE_LIST_STYLE_HEBREW, - eCSSKeyword_armenian, NS_STYLE_LIST_STYLE_ARMENIAN, - eCSSKeyword_georgian, NS_STYLE_LIST_STYLE_GEORGIAN, - eCSSKeyword_cjk_decimal, NS_STYLE_LIST_STYLE_CJK_DECIMAL, - eCSSKeyword_cjk_ideographic, NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC, - eCSSKeyword_hiragana, NS_STYLE_LIST_STYLE_HIRAGANA, - eCSSKeyword_katakana, NS_STYLE_LIST_STYLE_KATAKANA, - eCSSKeyword_hiragana_iroha, NS_STYLE_LIST_STYLE_HIRAGANA_IROHA, - eCSSKeyword_katakana_iroha, NS_STYLE_LIST_STYLE_KATAKANA_IROHA, eCSSKeyword_japanese_informal, NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL, eCSSKeyword_japanese_formal, NS_STYLE_LIST_STYLE_JAPANESE_FORMAL, eCSSKeyword_korean_hangul_formal, NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL, @@ -1393,37 +1385,8 @@ const KTableValue nsCSSProps::kListStyleKTable[] = { eCSSKeyword_simp_chinese_formal, NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL, eCSSKeyword_trad_chinese_informal, NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL, eCSSKeyword_trad_chinese_formal, NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL, - eCSSKeyword__moz_cjk_heavenly_stem, NS_STYLE_LIST_STYLE_MOZ_CJK_HEAVENLY_STEM, - eCSSKeyword__moz_cjk_earthly_branch, NS_STYLE_LIST_STYLE_MOZ_CJK_EARTHLY_BRANCH, - eCSSKeyword__moz_trad_chinese_informal, NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_INFORMAL, - eCSSKeyword__moz_trad_chinese_formal, NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_FORMAL, - eCSSKeyword__moz_simp_chinese_informal, NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_INFORMAL, - eCSSKeyword__moz_simp_chinese_formal, NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_FORMAL, - eCSSKeyword__moz_japanese_informal, NS_STYLE_LIST_STYLE_MOZ_JAPANESE_INFORMAL, - eCSSKeyword__moz_japanese_formal, NS_STYLE_LIST_STYLE_MOZ_JAPANESE_FORMAL, - eCSSKeyword__moz_arabic_indic, NS_STYLE_LIST_STYLE_MOZ_ARABIC_INDIC, - eCSSKeyword__moz_persian, NS_STYLE_LIST_STYLE_MOZ_PERSIAN, - eCSSKeyword__moz_urdu, NS_STYLE_LIST_STYLE_MOZ_URDU, - eCSSKeyword__moz_devanagari, NS_STYLE_LIST_STYLE_MOZ_DEVANAGARI, - eCSSKeyword__moz_gurmukhi, NS_STYLE_LIST_STYLE_MOZ_GURMUKHI, - eCSSKeyword__moz_gujarati, NS_STYLE_LIST_STYLE_MOZ_GUJARATI, - eCSSKeyword__moz_oriya, NS_STYLE_LIST_STYLE_MOZ_ORIYA, - eCSSKeyword__moz_kannada, NS_STYLE_LIST_STYLE_MOZ_KANNADA, - eCSSKeyword__moz_malayalam, NS_STYLE_LIST_STYLE_MOZ_MALAYALAM, - eCSSKeyword__moz_bengali, NS_STYLE_LIST_STYLE_MOZ_BENGALI, eCSSKeyword__moz_tamil, NS_STYLE_LIST_STYLE_MOZ_TAMIL, - eCSSKeyword__moz_telugu, NS_STYLE_LIST_STYLE_MOZ_TELUGU, - eCSSKeyword__moz_thai, NS_STYLE_LIST_STYLE_MOZ_THAI, - eCSSKeyword__moz_lao, NS_STYLE_LIST_STYLE_MOZ_LAO, - eCSSKeyword__moz_myanmar, NS_STYLE_LIST_STYLE_MOZ_MYANMAR, - eCSSKeyword__moz_khmer, NS_STYLE_LIST_STYLE_MOZ_KHMER, - eCSSKeyword__moz_hangul, NS_STYLE_LIST_STYLE_MOZ_HANGUL, - eCSSKeyword__moz_hangul_consonant, NS_STYLE_LIST_STYLE_MOZ_HANGUL_CONSONANT, - eCSSKeyword__moz_ethiopic_halehame, NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME, eCSSKeyword__moz_ethiopic_numeric, NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_NUMERIC, - eCSSKeyword__moz_ethiopic_halehame_am, NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_AM, - eCSSKeyword__moz_ethiopic_halehame_ti_er, NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ER, - eCSSKeyword__moz_ethiopic_halehame_ti_et, NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ET, eCSSKeyword_UNKNOWN,-1 }; diff --git a/layout/style/nsLayoutStylesheetCache.cpp b/layout/style/nsLayoutStylesheetCache.cpp index 16d54a75d6d..37389a62cdd 100644 --- a/layout/style/nsLayoutStylesheetCache.cpp +++ b/layout/style/nsLayoutStylesheetCache.cpp @@ -227,6 +227,16 @@ nsLayoutStylesheetCache::MathMLSheet() return gStyleCache->mMathMLSheet; } +nsCSSStyleSheet* +nsLayoutStylesheetCache::CounterStylesSheet() +{ + EnsureGlobal(); + if (!gStyleCache) + return nullptr; + + return gStyleCache->mCounterStylesSheet; +} + void nsLayoutStylesheetCache::Shutdown() { @@ -266,6 +276,7 @@ nsLayoutStylesheetCache::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf MEASURE(mQuirkSheet); MEASURE(mFullScreenOverrideSheet); MEASURE(mSVGSheet); + MEASURE(mCounterStylesSheet); if (mMathMLSheet) { MEASURE(mMathMLSheet); } @@ -337,6 +348,12 @@ nsLayoutStylesheetCache::nsLayoutStylesheetCache() } NS_ASSERTION(mSVGSheet, "Could not load svg.css"); + NS_NewURI(getter_AddRefs(uri), "resource://gre-resources/counterstyles.css"); + if (uri) { + LoadSheet(uri, mCounterStylesSheet, true); + } + NS_ASSERTION(mCounterStylesSheet, "Could not load counterstyles.css"); + // mMathMLSheet is created on-demand since its use is rare. This helps save // memory for Firefox OS apps. } diff --git a/layout/style/nsLayoutStylesheetCache.h b/layout/style/nsLayoutStylesheetCache.h index de869981396..3e82dc8a9d6 100644 --- a/layout/style/nsLayoutStylesheetCache.h +++ b/layout/style/nsLayoutStylesheetCache.h @@ -46,6 +46,7 @@ class nsLayoutStylesheetCache MOZ_FINAL static nsCSSStyleSheet* FullScreenOverrideSheet(); static nsCSSStyleSheet* SVGSheet(); static nsCSSStyleSheet* MathMLSheet(); + static nsCSSStyleSheet* CounterStylesSheet(); static void Shutdown(); @@ -77,6 +78,7 @@ private: nsRefPtr mFullScreenOverrideSheet; nsRefPtr mSVGSheet; nsRefPtr mMathMLSheet; + nsRefPtr mCounterStylesSheet; }; #endif diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h index e68cd1f386e..f422c74d71f 100644 --- a/layout/style/nsStyleConsts.h +++ b/layout/style/nsStyleConsts.h @@ -640,64 +640,23 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) { #define NS_STYLE_LIST_STYLE_CIRCLE 2 #define NS_STYLE_LIST_STYLE_SQUARE 3 #define NS_STYLE_LIST_STYLE_DECIMAL 4 -#define NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO 5 -#define NS_STYLE_LIST_STYLE_LOWER_ROMAN 6 -#define NS_STYLE_LIST_STYLE_UPPER_ROMAN 7 -#define NS_STYLE_LIST_STYLE_LOWER_GREEK 8 -#define NS_STYLE_LIST_STYLE_LOWER_ALPHA 9 -#define NS_STYLE_LIST_STYLE_LOWER_LATIN 9 // == ALPHA -#define NS_STYLE_LIST_STYLE_UPPER_ALPHA 10 -#define NS_STYLE_LIST_STYLE_UPPER_LATIN 10 // == ALPHA -#define NS_STYLE_LIST_STYLE_HEBREW 11 -#define NS_STYLE_LIST_STYLE_ARMENIAN 12 -#define NS_STYLE_LIST_STYLE_GEORGIAN 13 -#define NS_STYLE_LIST_STYLE_CJK_DECIMAL 14 -#define NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC 15 -#define NS_STYLE_LIST_STYLE_HIRAGANA 16 -#define NS_STYLE_LIST_STYLE_KATAKANA 17 -#define NS_STYLE_LIST_STYLE_HIRAGANA_IROHA 18 -#define NS_STYLE_LIST_STYLE_KATAKANA_IROHA 19 -#define NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL 20 -#define NS_STYLE_LIST_STYLE_JAPANESE_FORMAL 21 -#define NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL 22 -#define NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL 23 -#define NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL 24 -#define NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL 25 -#define NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL 26 -#define NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL 27 -#define NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL 28 -#define NS_STYLE_LIST_STYLE_MOZ_CJK_HEAVENLY_STEM 124 -#define NS_STYLE_LIST_STYLE_MOZ_CJK_EARTHLY_BRANCH 125 -#define NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_INFORMAL 126 -#define NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_FORMAL 127 -#define NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_INFORMAL 128 -#define NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_FORMAL 129 -#define NS_STYLE_LIST_STYLE_MOZ_JAPANESE_INFORMAL 130 -#define NS_STYLE_LIST_STYLE_MOZ_JAPANESE_FORMAL 131 -#define NS_STYLE_LIST_STYLE_MOZ_ARABIC_INDIC 132 -#define NS_STYLE_LIST_STYLE_MOZ_PERSIAN 133 -#define NS_STYLE_LIST_STYLE_MOZ_URDU 134 -#define NS_STYLE_LIST_STYLE_MOZ_DEVANAGARI 135 -#define NS_STYLE_LIST_STYLE_MOZ_GURMUKHI 136 -#define NS_STYLE_LIST_STYLE_MOZ_GUJARATI 137 -#define NS_STYLE_LIST_STYLE_MOZ_ORIYA 138 -#define NS_STYLE_LIST_STYLE_MOZ_KANNADA 139 -#define NS_STYLE_LIST_STYLE_MOZ_MALAYALAM 140 -#define NS_STYLE_LIST_STYLE_MOZ_BENGALI 141 -#define NS_STYLE_LIST_STYLE_MOZ_TAMIL 142 -#define NS_STYLE_LIST_STYLE_MOZ_TELUGU 143 -#define NS_STYLE_LIST_STYLE_MOZ_THAI 144 -#define NS_STYLE_LIST_STYLE_MOZ_LAO 145 -#define NS_STYLE_LIST_STYLE_MOZ_MYANMAR 146 -#define NS_STYLE_LIST_STYLE_MOZ_KHMER 147 -#define NS_STYLE_LIST_STYLE_MOZ_HANGUL 148 -#define NS_STYLE_LIST_STYLE_MOZ_HANGUL_CONSONANT 149 -#define NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME 150 -#define NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_NUMERIC 151 -#define NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_AM 152 -#define NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ER 153 -#define NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ET 154 -#define NS_STYLE_LIST_STYLE__MAX 155 +#define NS_STYLE_LIST_STYLE_LOWER_ROMAN 5 +#define NS_STYLE_LIST_STYLE_UPPER_ROMAN 6 +#define NS_STYLE_LIST_STYLE_LOWER_ALPHA 7 +#define NS_STYLE_LIST_STYLE_UPPER_ALPHA 8 +#define NS_STYLE_LIST_STYLE_HEBREW 9 +#define NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL 10 +#define NS_STYLE_LIST_STYLE_JAPANESE_FORMAL 11 +#define NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL 12 +#define NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL 13 +#define NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL 14 +#define NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL 15 +#define NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL 16 +#define NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL 17 +#define NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL 18 +#define NS_STYLE_LIST_STYLE_MOZ_TAMIL 19 +#define NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_NUMERIC 20 +#define NS_STYLE_LIST_STYLE__MAX 21 // See nsStyleList #define NS_STYLE_LIST_STYLE_POSITION_INSIDE 0 From 66f043f77bd62ec4b39bf4f1c1c2d5f262197720 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 11 Jun 2014 21:13:00 -0400 Subject: [PATCH 10/68] Bug 966166 - Part 5: Move computation code with minor changes. r=dbaron In addition to moving the code, this patch also: * changes the square character from U+25AA to U+25FE to match the spec * changes all the generating functions from using append to using assign * removes negative handling from CJKIdeographicToText since it is no longer used there * fixes indentation and naming conventions * changes buffer size in DecimalToText --- accessible/tests/mochitest/common.js | 2 +- layout/generic/nsBulletFrame.cpp | 505 --------------------------- layout/generic/nsBulletFrame.h | 13 +- layout/style/CounterStyleManager.cpp | 482 +++++++++++++++++++++++-- 4 files changed, 455 insertions(+), 547 deletions(-) diff --git a/accessible/tests/mochitest/common.js b/accessible/tests/mochitest/common.js index 2851fbfd7a9..314058b096d 100644 --- a/accessible/tests/mochitest/common.js +++ b/accessible/tests/mochitest/common.js @@ -83,7 +83,7 @@ const kEmbedChar = String.fromCharCode(0xfffc); const kDiscBulletChar = String.fromCharCode(0x2022); const kDiscBulletText = kDiscBulletChar + " "; const kCircleBulletText = String.fromCharCode(0x25e6) + " "; -const kSquareBulletText = String.fromCharCode(0x25aa) + " "; +const kSquareBulletText = String.fromCharCode(0x25fe) + " "; const MAX_TRIM_LENGTH = 100; diff --git a/layout/generic/nsBulletFrame.cpp b/layout/generic/nsBulletFrame.cpp index 6089c71e706..57ecbdb3347 100644 --- a/layout/generic/nsBulletFrame.cpp +++ b/layout/generic/nsBulletFrame.cpp @@ -16,7 +16,6 @@ #include "nsIPresShell.h" #include "nsIDocument.h" #include "nsRenderingContext.h" -#include "prprf.h" #include "nsDisplayList.h" #include "nsCounterManager.h" #include "nsBidiUtils.h" @@ -405,510 +404,6 @@ nsBulletFrame::SetListItemOrdinal(int32_t aNextOrdinal, return nsCounterManager::IncrementCounter(mOrdinal, aIncrement); } - -/** - * For all functions below, a return value of true means that we - * could represent mOrder in the desired numbering system. false - * means we had to fall back to decimal - */ -static bool DecimalToText(int32_t ordinal, nsString& result) -{ - char cbuf[40]; - PR_snprintf(cbuf, sizeof(cbuf), "%ld", ordinal); - result.AppendASCII(cbuf); - return true; -} -static bool TamilToText(int32_t ordinal, nsString& result) -{ - if (ordinal < 1 || ordinal > 9999) { - // Can't do those in this system. - return false; - } - char16_t diff = 0x0BE6 - char16_t('0'); - // We're going to be appending to whatever is in "result" already, so make - // sure to only munge the new bits. Note that we can't just grab the pointer - // to the new stuff here, since appending to the string can realloc. - size_t offset = result.Length(); - DecimalToText(ordinal, result); - char16_t* p = result.BeginWriting() + offset; - for(; '\0' != *p ; p++) - if(*p != char16_t('0')) - *p += diff; - return true; -} - -// We know cjk-ideographic need 31 characters to display 99,999,999,999,999,999 -// georgian needs 6 at most -// armenian needs 12 at most -// hebrew may need more... - -#define NUM_BUF_SIZE 34 - -enum CJKIdeographicLang { - CHINESE, KOREAN, JAPANESE -}; -struct CJKIdeographicData { - const char16_t *negative; - char16_t digit[10]; - char16_t unit[3]; - char16_t unit10K[2]; - uint8_t lang; - bool informal; -}; -extern const char16_t gJapaneseNegative[] = { - 0x30de, 0x30a4, 0x30ca, 0x30b9, 0x0000 -}; -static const CJKIdeographicData gDataJapaneseInformal = { - gJapaneseNegative, // negative - { // digit - 0x3007, 0x4e00, 0x4e8c, 0x4e09, 0x56db, - 0x4e94, 0x516d, 0x4e03, 0x516b, 0x4e5d - }, - { 0x5341, 0x767e, 0x5343 }, // unit - { 0x4e07, 0x5104 }, // unit10K - JAPANESE, // lang - true // informal -}; -static const CJKIdeographicData gDataJapaneseFormal = { - gJapaneseNegative, // negative - { // digit - 0x96f6, 0x58f1, 0x5f10, 0x53c2, 0x56db, - 0x4f0d, 0x516d, 0x4e03, 0x516b, 0x4e5d - }, - { 0x62fe, 0x767e, 0x9621 }, // unit - { 0x842c, 0x5104 }, // unit10K - JAPANESE, // lang - false // informal -}; -extern const char16_t gKoreanNegative[] = { - 0xb9c8, 0xc774, 0xb108, 0xc2a4, 0x0020, 0x0000 -}; -static const CJKIdeographicData gDataKoreanHangulFormal = { - gKoreanNegative, // negative - { // digit - 0xc601, 0xc77c, 0xc774, 0xc0bc, 0xc0ac, - 0xc624, 0xc721, 0xce60, 0xd314, 0xad6c - }, - { 0xc2ed, 0xbc31, 0xcc9c }, // unit - { 0xb9cc, 0xc5b5 }, // unit10K - KOREAN, // lang - false // informal -}; -static const CJKIdeographicData gDataKoreanHanjaInformal = { - gKoreanNegative, // negative - { // digit - 0x96f6, 0x4e00, 0x4e8c, 0x4e09, 0x56db, - 0x4e94, 0x516d, 0x4e03, 0x516b, 0x4e5d - }, - { 0x5341, 0x767e, 0x5343 }, // unit - { 0x842c, 0x5104 }, // unit10K - KOREAN, // lang - true // informal -}; -static const CJKIdeographicData gDataKoreanHanjaFormal = { - gKoreanNegative, // negative - { // digit - 0x96f6, 0x58f9, 0x8cb3, 0x53c3, 0x56db, - 0x4e94, 0x516d, 0x4e03, 0x516b, 0x4e5d - }, - { 0x62fe, 0x767e, 0x4edf }, // unit - { 0x842c, 0x5104 }, // unit10K - KOREAN, // lang - false // informal -}; -extern const char16_t gSimpChineseNegative[] = { - 0x8d1f, 0x0000 -}; -static const CJKIdeographicData gDataSimpChineseInformal = { - gSimpChineseNegative, // negative - { // digit - 0x96f6, 0x4e00, 0x4e8c, 0x4e09, 0x56db, - 0x4e94, 0x516d, 0x4e03, 0x516b, 0x4e5d - }, - { 0x5341, 0x767e, 0x5343 }, // unit - { 0x4e07, 0x4ebf }, // unit10K - CHINESE, // lang - true // informal -}; -static const CJKIdeographicData gDataSimpChineseFormal = { - gSimpChineseNegative, // negative - { // digit - 0x96f6, 0x58f9, 0x8d30, 0x53c1, 0x8086, - 0x4f0d, 0x9646, 0x67d2, 0x634c, 0x7396 - }, - { 0x62fe, 0x4f70, 0x4edf }, // unit - { 0x4e07, 0x4ebf }, // unit10K - CHINESE, // lang - false // informal -}; -extern const char16_t gTradChineseNegative[] = { - 0x8ca0, 0x0000 -}; -static const CJKIdeographicData gDataTradChineseInformal = { - gTradChineseNegative, // negative - { // digit - 0x96f6, 0x4e00, 0x4e8c, 0x4e09, 0x56db, - 0x4e94, 0x516d, 0x4e03, 0x516b, 0x4e5d - }, - { 0x5341, 0x767e, 0x5343 }, // unit - { 0x842c, 0x5104 }, // unit10K - CHINESE, // lang - true // informal -}; -static const CJKIdeographicData gDataTradChineseFormal = { - gTradChineseNegative, // negative - { // digit - 0x96f6, 0x58f9, 0x8cb3, 0x53c3, 0x8086, - 0x4f0d, 0x9678, 0x67d2, 0x634c, 0x7396 - }, - { 0x62fe, 0x4f70, 0x4edf }, // unit - { 0x842c, 0x5104 }, // unit10K - CHINESE, // lang - false // informal -}; - -static const bool CJKIdeographicToText(int32_t aOrdinal, nsString& result, - const CJKIdeographicData& data) -{ - char16_t buf[NUM_BUF_SIZE]; - int32_t idx = NUM_BUF_SIZE; - int32_t pos = 0; - bool isNegative = (aOrdinal < 0); - bool needZero = (aOrdinal == 0); - int32_t unitidx = 0, unit10Kidx = 0; - uint32_t ordinal = mozilla::Abs(aOrdinal); - do { - unitidx = pos % 4; - if (unitidx == 0) { - unit10Kidx = pos / 4; - } - int32_t cur = ordinal % 10; - if (cur == 0) { - if (needZero) { - needZero = false; - buf[--idx] = data.digit[0]; - } - } else { - if (data.lang == CHINESE) { - needZero = true; - } - if (unit10Kidx != 0) { - if (data.lang == KOREAN && idx != NUM_BUF_SIZE) { - buf[--idx] = ' '; - } - buf[--idx] = data.unit10K[unit10Kidx - 1]; - } - if (unitidx != 0) { - buf[--idx] = data.unit[unitidx - 1]; - } - if (cur != 1) { - buf[--idx] = data.digit[cur]; - } else { - bool needOne = true; - if (data.informal) { - switch (data.lang) { - case CHINESE: - if (unitidx == 1 && - (ordinal == 1 || (pos > 4 && ordinal % 1000 == 1))) { - needOne = false; - } - break; - case JAPANESE: - if (unitidx > 0 && - (unitidx != 3 || (pos == 3 && ordinal == 1))) { - needOne = false; - } - break; - case KOREAN: - if (unitidx > 0 || (pos == 4 && (ordinal % 1000) == 1)) { - needOne = false; - } - break; - } - } - if (needOne) { - buf[--idx] = data.digit[1]; - } - } - unit10Kidx = 0; - } - ordinal /= 10; - pos++; - } while (ordinal > 0); - if (isNegative) { - result.Append(data.negative); - } - result.Append(buf + idx, NUM_BUF_SIZE - idx); - return true; -} - -#define HEBREW_GERESH 0x05F3 -static const char16_t gHebrewDigit[22] = -{ -// 1 2 3 4 5 6 7 8 9 -0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, -// 10 20 30 40 50 60 70 80 90 -0x05D9, 0x05DB, 0x05DC, 0x05DE, 0x05E0, 0x05E1, 0x05E2, 0x05E4, 0x05E6, -// 100 200 300 400 -0x05E7, 0x05E8, 0x05E9, 0x05EA -}; - -static bool HebrewToText(int32_t ordinal, nsString& result) -{ - if (ordinal < 1 || ordinal > 999999) { - return false; - } - bool outputSep = false; - nsAutoString allText, thousandsGroup; - do { - thousandsGroup.Truncate(); - int32_t n3 = ordinal % 1000; - // Process digit for 100 - 900 - for(int32_t n1 = 400; n1 > 0; ) - { - if( n3 >= n1) - { - n3 -= n1; - thousandsGroup.Append(gHebrewDigit[(n1/100)-1+18]); - } else { - n1 -= 100; - } // if - } // for - - // Process digit for 10 - 90 - int32_t n2; - if( n3 >= 10 ) - { - // Special process for 15 and 16 - if(( 15 == n3 ) || (16 == n3)) { - // Special rule for religious reason... - // 15 is represented by 9 and 6, not 10 and 5 - // 16 is represented by 9 and 7, not 10 and 6 - n2 = 9; - thousandsGroup.Append(gHebrewDigit[ n2 - 1]); - } else { - n2 = n3 - (n3 % 10); - thousandsGroup.Append(gHebrewDigit[(n2/10)-1+9]); - } // if - n3 -= n2; - } // if - - // Process digit for 1 - 9 - if ( n3 > 0) - thousandsGroup.Append(gHebrewDigit[n3-1]); - if (outputSep) - thousandsGroup.Append((char16_t)HEBREW_GERESH); - if (allText.IsEmpty()) - allText = thousandsGroup; - else - allText = thousandsGroup + allText; - ordinal /= 1000; - outputSep = true; - } while (ordinal >= 1); - - result.Append(allText); - return true; -} - -// Convert ordinal to Ethiopic numeric representation. -// The detail is available at http://www.ethiopic.org/Numerals/ -// The algorithm used here is based on the pseudo-code put up there by -// Daniel Yacob . -// Another reference is Unicode 3.0 standard section 11.1. -#define ETHIOPIC_ONE 0x1369 -#define ETHIOPIC_TEN 0x1372 -#define ETHIOPIC_HUNDRED 0x137B -#define ETHIOPIC_TEN_THOUSAND 0x137C - -static bool EthiopicToText(int32_t ordinal, nsString& result) -{ - if (ordinal < 1) { - return false; - } - nsAutoString asciiNumberString; // decimal string representation of ordinal - DecimalToText(ordinal, asciiNumberString); - uint8_t asciiStringLength = asciiNumberString.Length(); - - // If number length is odd, add a leading "0" - // the leading "0" preconditions the string to always have the - // leading tens place populated, this avoids a check within the loop. - // If we didn't add the leading "0", decrement asciiStringLength so - // it will be equivalent to a zero-based index in both cases. - if (asciiStringLength & 1) { - asciiNumberString.Insert(NS_LITERAL_STRING("0"), 0); - } else { - asciiStringLength--; - } - - // Iterate from the highest digits to lowest - // indexFromLeft indexes digits (0 = most significant) - // groupIndexFromRight indexes pairs of digits (0 = least significant) - for (uint8_t indexFromLeft = 0, groupIndexFromRight = asciiStringLength >> 1; - indexFromLeft <= asciiStringLength; - indexFromLeft += 2, groupIndexFromRight--) { - uint8_t tensValue = asciiNumberString.CharAt(indexFromLeft) & 0x0F; - uint8_t unitsValue = asciiNumberString.CharAt(indexFromLeft + 1) & 0x0F; - uint8_t groupValue = tensValue * 10 + unitsValue; - - bool oddGroup = (groupIndexFromRight & 1); - - // we want to clear ETHIOPIC_ONE when it is superfluous - if (ordinal > 1 && - groupValue == 1 && // one without a leading ten - (oddGroup || indexFromLeft == 0)) { // preceding (100) or leading the sequence - unitsValue = 0; - } - - // put it all together... - if (tensValue) { - // map onto Ethiopic "tens": - result.Append((char16_t) (tensValue + ETHIOPIC_TEN - 1)); - } - if (unitsValue) { - //map onto Ethiopic "units": - result.Append((char16_t) (unitsValue + ETHIOPIC_ONE - 1)); - } - // Add a separator for all even groups except the last, - // and for odd groups with non-zero value. - if (oddGroup) { - if (groupValue) { - result.Append((char16_t) ETHIOPIC_HUNDRED); - } - } else { - if (groupIndexFromRight) { - result.Append((char16_t) ETHIOPIC_TEN_THOUSAND); - } - } - } - return true; -} - - -/* static */ void -nsBulletFrame::AppendCounterText(int32_t aListStyleType, - int32_t aOrdinal, - nsString& result, - bool& isRTL) -{ - bool success = true; - int32_t fallback = NS_STYLE_LIST_STYLE_DECIMAL; - isRTL = false; - - switch (aListStyleType) { - case NS_STYLE_LIST_STYLE_NONE: // used by counters code only - break; - - case NS_STYLE_LIST_STYLE_DISC: // used by counters code only - // XXX We really need to do this the same way we do list bullets. - result.Append(char16_t(0x2022)); - break; - - case NS_STYLE_LIST_STYLE_CIRCLE: // used by counters code only - // XXX We really need to do this the same way we do list bullets. - result.Append(char16_t(0x25E6)); - break; - - case NS_STYLE_LIST_STYLE_SQUARE: // used by counters code only - // XXX We really need to do this the same way we do list bullets. - result.Append(char16_t(0x25FE)); - break; - - case NS_STYLE_LIST_STYLE_DECIMAL: - default: // CSS2 say "A users agent that does not recognize a numbering system - // should use 'decimal' - success = DecimalToText(aOrdinal, result); - NS_ASSERTION(success, "DecimalToText must never fail"); - break; - - case NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL: - success = - CJKIdeographicToText(aOrdinal, result, gDataTradChineseInformal); - break; - - case NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL: - success = CJKIdeographicToText(aOrdinal, result, gDataTradChineseFormal); - break; - - case NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL: - success = - CJKIdeographicToText(aOrdinal, result, gDataSimpChineseInformal); - break; - - case NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL: - success = CJKIdeographicToText(aOrdinal, result, gDataSimpChineseFormal); - break; - - case NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL: - success = CJKIdeographicToText(aOrdinal, result, gDataJapaneseInformal); - break; - - case NS_STYLE_LIST_STYLE_JAPANESE_FORMAL: - success = CJKIdeographicToText(aOrdinal, result, gDataJapaneseFormal); - break; - - case NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL: - success = - CJKIdeographicToText(aOrdinal, result, gDataKoreanHangulFormal); - break; - - case NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL: - success = - CJKIdeographicToText(aOrdinal, result, gDataKoreanHanjaInformal); - break; - - case NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL: - success = CJKIdeographicToText(aOrdinal, result, gDataKoreanHanjaFormal); - break; - - case NS_STYLE_LIST_STYLE_HEBREW: - isRTL = true; - success = HebrewToText(aOrdinal, result); - break; - - case NS_STYLE_LIST_STYLE_MOZ_TAMIL: - success = TamilToText(aOrdinal, result); - break; - - case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_NUMERIC: - success = EthiopicToText(aOrdinal, result); - break; - } - if (!success) { - AppendCounterText(fallback, aOrdinal, result, isRTL); - } -} - -/* static */ void -nsBulletFrame::GetListItemSuffix(int32_t aListStyleType, - nsString& aResult) -{ - aResult.AssignLiteral(MOZ_UTF16(". ")); - - switch (aListStyleType) { - case NS_STYLE_LIST_STYLE_NONE: // used by counters code only - case NS_STYLE_LIST_STYLE_DISC: // used by counters code only - case NS_STYLE_LIST_STYLE_CIRCLE: // used by counters code only - case NS_STYLE_LIST_STYLE_SQUARE: // used by counters code only - aResult = ' '; - break; - - case NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL: - case NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL: - case NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL: - case NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL: - case NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL: - case NS_STYLE_LIST_STYLE_JAPANESE_FORMAL: - aResult = 0x3001; - break; - - case NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL: - case NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL: - case NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL: - aResult.AssignLiteral(MOZ_UTF16(", ")); - break; - } -} - void nsBulletFrame::GetListItemText(nsAString& aResult) { diff --git a/layout/generic/nsBulletFrame.h b/layout/generic/nsBulletFrame.h index 26cc466ddb8..a57331b49bd 100644 --- a/layout/generic/nsBulletFrame.h +++ b/layout/generic/nsBulletFrame.h @@ -76,18 +76,7 @@ public: int32_t SetListItemOrdinal(int32_t aNextOrdinal, bool* aChanged, int32_t aIncrement); - - /* get list item text, without '.' */ - static void AppendCounterText(int32_t aListStyleType, - int32_t aOrdinal, - nsString& aResult, - bool& aIsRTL); - - /* get suffix of list item */ - static void GetListItemSuffix(int32_t aListStyleType, - nsString& aResult); - - /* get list item text, with '.' */ + /* get list item text, with prefix & suffix */ void GetListItemText(nsAString& aResult); void GetSpokenText(nsAString& aText); diff --git a/layout/style/CounterStyleManager.cpp b/layout/style/CounterStyleManager.cpp index b3b1e57f3e4..c4f247febcc 100644 --- a/layout/style/CounterStyleManager.cpp +++ b/layout/style/CounterStyleManager.cpp @@ -10,22 +10,14 @@ #include "mozilla/CheckedInt.h" #include "mozilla/MathAlgorithms.h" #include "mozilla/ArrayUtils.h" +#include "prprf.h" #include "nsString.h" #include "nsStyleSet.h" #include "nsCSSRules.h" #include "nsTArray.h" -#include "nsBulletFrame.h" #include "nsTHashtable.h" #include "nsUnicodeProperties.h" -// XXX The following global constants are defined in nsBulletFrame.cpp -// They are temporarily referenced here. All counter text generating code should -// be moved here in some later patches. -extern const char16_t gJapaneseNegative[]; -extern const char16_t gKoreanNegative[]; -extern const char16_t gSimpChineseNegative[]; -extern const char16_t gTradChineseNegative[]; - namespace mozilla { struct AdditiveSymbol @@ -213,6 +205,360 @@ GetAdditiveCounterText(CounterValue aOrdinal, return aOrdinal == 0; } +static bool +DecimalToText(CounterValue aOrdinal, nsSubstring& aResult) +{ + // 3 for additional digit, negative sign, and null + char cbuf[std::numeric_limits::digits10 + 3]; + PR_snprintf(cbuf, sizeof(cbuf), "%ld", aOrdinal); + aResult.AssignASCII(cbuf); + return true; +} + +static bool +TamilToText(CounterValue aOrdinal, nsSubstring& aResult) +{ + if (aOrdinal < 1 || aOrdinal > 9999) { + return false; + } + char16_t diff = 0x0BE6 - char16_t('0'); + // We're going to be appending to whatever is in "result" already, so make + // sure to only munge the new bits. Note that we can't just grab the pointer + // to the new stuff here, since appending to the string can realloc. + DecimalToText(aOrdinal, aResult); + char16_t* p = aResult.BeginWriting(); + for(; '\0' != *p ; p++) + if(*p != char16_t('0')) + *p += diff; + return true; +} + +// We know cjk-ideographic need 31 characters to display 99,999,999,999,999,999 +// georgian needs 6 at most +// armenian needs 12 at most +// hebrew may need more... + +#define NUM_BUF_SIZE 34 + +enum CJKIdeographicLang { + CHINESE, KOREAN, JAPANESE +}; +struct CJKIdeographicData { + char16_t digit[10]; + char16_t unit[3]; + char16_t unit10K[2]; + uint8_t lang; + bool informal; +}; +static const CJKIdeographicData gDataJapaneseInformal = { + { // digit + 0x3007, 0x4e00, 0x4e8c, 0x4e09, 0x56db, + 0x4e94, 0x516d, 0x4e03, 0x516b, 0x4e5d + }, + { 0x5341, 0x767e, 0x5343 }, // unit + { 0x4e07, 0x5104 }, // unit10K + JAPANESE, // lang + true // informal +}; +static const CJKIdeographicData gDataJapaneseFormal = { + { // digit + 0x96f6, 0x58f1, 0x5f10, 0x53c2, 0x56db, + 0x4f0d, 0x516d, 0x4e03, 0x516b, 0x4e5d + }, + { 0x62fe, 0x767e, 0x9621 }, // unit + { 0x842c, 0x5104 }, // unit10K + JAPANESE, // lang + false // informal +}; +static const CJKIdeographicData gDataKoreanHangulFormal = { + { // digit + 0xc601, 0xc77c, 0xc774, 0xc0bc, 0xc0ac, + 0xc624, 0xc721, 0xce60, 0xd314, 0xad6c + }, + { 0xc2ed, 0xbc31, 0xcc9c }, // unit + { 0xb9cc, 0xc5b5 }, // unit10K + KOREAN, // lang + false // informal +}; +static const CJKIdeographicData gDataKoreanHanjaInformal = { + { // digit + 0x96f6, 0x4e00, 0x4e8c, 0x4e09, 0x56db, + 0x4e94, 0x516d, 0x4e03, 0x516b, 0x4e5d + }, + { 0x5341, 0x767e, 0x5343 }, // unit + { 0x842c, 0x5104 }, // unit10K + KOREAN, // lang + true // informal +}; +static const CJKIdeographicData gDataKoreanHanjaFormal = { + { // digit + 0x96f6, 0x58f9, 0x8cb3, 0x53c3, 0x56db, + 0x4e94, 0x516d, 0x4e03, 0x516b, 0x4e5d + }, + { 0x62fe, 0x767e, 0x4edf }, // unit + { 0x842c, 0x5104 }, // unit10K + KOREAN, // lang + false // informal +}; +static const CJKIdeographicData gDataSimpChineseInformal = { + { // digit + 0x96f6, 0x4e00, 0x4e8c, 0x4e09, 0x56db, + 0x4e94, 0x516d, 0x4e03, 0x516b, 0x4e5d + }, + { 0x5341, 0x767e, 0x5343 }, // unit + { 0x4e07, 0x4ebf }, // unit10K + CHINESE, // lang + true // informal +}; +static const CJKIdeographicData gDataSimpChineseFormal = { + { // digit + 0x96f6, 0x58f9, 0x8d30, 0x53c1, 0x8086, + 0x4f0d, 0x9646, 0x67d2, 0x634c, 0x7396 + }, + { 0x62fe, 0x4f70, 0x4edf }, // unit + { 0x4e07, 0x4ebf }, // unit10K + CHINESE, // lang + false // informal +}; +static const CJKIdeographicData gDataTradChineseInformal = { + { // digit + 0x96f6, 0x4e00, 0x4e8c, 0x4e09, 0x56db, + 0x4e94, 0x516d, 0x4e03, 0x516b, 0x4e5d + }, + { 0x5341, 0x767e, 0x5343 }, // unit + { 0x842c, 0x5104 }, // unit10K + CHINESE, // lang + true // informal +}; +static const CJKIdeographicData gDataTradChineseFormal = { + { // digit + 0x96f6, 0x58f9, 0x8cb3, 0x53c3, 0x8086, + 0x4f0d, 0x9678, 0x67d2, 0x634c, 0x7396 + }, + { 0x62fe, 0x4f70, 0x4edf }, // unit + { 0x842c, 0x5104 }, // unit10K + CHINESE, // lang + false // informal +}; + +static bool +CJKIdeographicToText(CounterValue aOrdinal, nsSubstring& aResult, + const CJKIdeographicData& data) +{ + NS_ASSERTION(aOrdinal >= 0, "Only accept non-negative ordinal"); + char16_t buf[NUM_BUF_SIZE]; + int32_t idx = NUM_BUF_SIZE; + int32_t pos = 0; + bool needZero = (aOrdinal == 0); + int32_t unitidx = 0, unit10Kidx = 0; + do { + unitidx = pos % 4; + if (unitidx == 0) { + unit10Kidx = pos / 4; + } + int32_t cur = aOrdinal % 10; + if (cur == 0) { + if (needZero) { + needZero = false; + buf[--idx] = data.digit[0]; + } + } else { + if (data.lang == CHINESE) { + needZero = true; + } + if (unit10Kidx != 0) { + if (data.lang == KOREAN && idx != NUM_BUF_SIZE) { + buf[--idx] = ' '; + } + buf[--idx] = data.unit10K[unit10Kidx - 1]; + } + if (unitidx != 0) { + buf[--idx] = data.unit[unitidx - 1]; + } + if (cur != 1) { + buf[--idx] = data.digit[cur]; + } else { + bool needOne = true; + if (data.informal) { + switch (data.lang) { + case CHINESE: + if (unitidx == 1 && + (aOrdinal == 1 || (pos > 4 && aOrdinal % 1000 == 1))) { + needOne = false; + } + break; + case JAPANESE: + if (unitidx > 0 && + (unitidx != 3 || (pos == 3 && aOrdinal == 1))) { + needOne = false; + } + break; + case KOREAN: + if (unitidx > 0 || (pos == 4 && (aOrdinal % 1000) == 1)) { + needOne = false; + } + break; + } + } + if (needOne) { + buf[--idx] = data.digit[1]; + } + } + unit10Kidx = 0; + } + aOrdinal /= 10; + pos++; + } while (aOrdinal > 0); + aResult.Assign(buf + idx, NUM_BUF_SIZE - idx); + return true; +} + +#define HEBREW_GERESH 0x05F3 +static const char16_t gHebrewDigit[22] = +{ + // 1 2 3 4 5 6 7 8 9 + 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, + // 10 20 30 40 50 60 70 80 90 + 0x05D9, 0x05DB, 0x05DC, 0x05DE, 0x05E0, 0x05E1, 0x05E2, 0x05E4, 0x05E6, + // 100 200 300 400 + 0x05E7, 0x05E8, 0x05E9, 0x05EA +}; + +static bool +HebrewToText(CounterValue aOrdinal, nsSubstring& aResult) +{ + if (aOrdinal < 1 || aOrdinal > 999999) { + return false; + } + + bool outputSep = false; + nsAutoString allText, thousandsGroup; + do { + thousandsGroup.Truncate(); + int32_t n3 = aOrdinal % 1000; + // Process digit for 100 - 900 + for(int32_t n1 = 400; n1 > 0; ) + { + if( n3 >= n1) + { + n3 -= n1; + thousandsGroup.Append(gHebrewDigit[(n1/100)-1+18]); + } else { + n1 -= 100; + } // if + } // for + + // Process digit for 10 - 90 + int32_t n2; + if( n3 >= 10 ) + { + // Special process for 15 and 16 + if(( 15 == n3 ) || (16 == n3)) { + // Special rule for religious reason... + // 15 is represented by 9 and 6, not 10 and 5 + // 16 is represented by 9 and 7, not 10 and 6 + n2 = 9; + thousandsGroup.Append(gHebrewDigit[ n2 - 1]); + } else { + n2 = n3 - (n3 % 10); + thousandsGroup.Append(gHebrewDigit[(n2/10)-1+9]); + } // if + n3 -= n2; + } // if + + // Process digit for 1 - 9 + if ( n3 > 0) + thousandsGroup.Append(gHebrewDigit[n3-1]); + if (outputSep) + thousandsGroup.Append((char16_t)HEBREW_GERESH); + if (allText.IsEmpty()) + allText = thousandsGroup; + else + allText = thousandsGroup + allText; + aOrdinal /= 1000; + outputSep = true; + } while (aOrdinal >= 1); + + aResult = allText; + return true; +} + +// Convert ordinal to Ethiopic numeric representation. +// The detail is available at http://www.ethiopic.org/Numerals/ +// The algorithm used here is based on the pseudo-code put up there by +// Daniel Yacob . +// Another reference is Unicode 3.0 standard section 11.1. +#define ETHIOPIC_ONE 0x1369 +#define ETHIOPIC_TEN 0x1372 +#define ETHIOPIC_HUNDRED 0x137B +#define ETHIOPIC_TEN_THOUSAND 0x137C + +static bool +EthiopicToText(CounterValue aOrdinal, nsSubstring& aResult) +{ + if (aOrdinal < 1) { + return false; + } + + nsAutoString asciiNumberString; // decimal string representation of ordinal + DecimalToText(aOrdinal, asciiNumberString); + uint8_t asciiStringLength = asciiNumberString.Length(); + + // If number length is odd, add a leading "0" + // the leading "0" preconditions the string to always have the + // leading tens place populated, this avoids a check within the loop. + // If we didn't add the leading "0", decrement asciiStringLength so + // it will be equivalent to a zero-based index in both cases. + if (asciiStringLength & 1) { + asciiNumberString.Insert(NS_LITERAL_STRING("0"), 0); + } else { + asciiStringLength--; + } + + aResult.Truncate(); + // Iterate from the highest digits to lowest + // indexFromLeft indexes digits (0 = most significant) + // groupIndexFromRight indexes pairs of digits (0 = least significant) + for (uint8_t indexFromLeft = 0, groupIndexFromRight = asciiStringLength >> 1; + indexFromLeft <= asciiStringLength; + indexFromLeft += 2, groupIndexFromRight--) { + uint8_t tensValue = asciiNumberString.CharAt(indexFromLeft) & 0x0F; + uint8_t unitsValue = asciiNumberString.CharAt(indexFromLeft + 1) & 0x0F; + uint8_t groupValue = tensValue * 10 + unitsValue; + + bool oddGroup = (groupIndexFromRight & 1); + + // we want to clear ETHIOPIC_ONE when it is superfluous + if (aOrdinal > 1 && + groupValue == 1 && // one without a leading ten + (oddGroup || indexFromLeft == 0)) { // preceding (100) or leading the sequence + unitsValue = 0; + } + + // put it all together... + if (tensValue) { + // map onto Ethiopic "tens": + aResult.Append((char16_t) (tensValue + ETHIOPIC_TEN - 1)); + } + if (unitsValue) { + //map onto Ethiopic "units": + aResult.Append((char16_t) (unitsValue + ETHIOPIC_ONE - 1)); + } + // Add a separator for all even groups except the last, + // and for odd groups with non-zero value. + if (oddGroup) { + if (groupValue) { + aResult.Append((char16_t) ETHIOPIC_HUNDRED); + } + } else { + if (groupIndexFromRight) { + aResult.Append((char16_t) ETHIOPIC_TEN_THOUSAND); + } + } + } + return true; +} + class BuiltinCounterStyle : public CounterStyle { public: @@ -267,17 +613,42 @@ BuiltinCounterStyle::GetPrefix(nsSubstring& aResult) /* virtual */ void BuiltinCounterStyle::GetSuffix(nsSubstring& aResult) { - // XXX nsBulletFrame::GetListItemSuffix accepts only nsString&, so we reassign - // the result here. This could be avoided when the whole code is moved here. - nsAutoString result; - nsBulletFrame::GetListItemSuffix(mStyle, result); - aResult = result; + switch (mStyle) { + case NS_STYLE_LIST_STYLE_NONE: + aResult.Truncate(); + break; + + case NS_STYLE_LIST_STYLE_DISC: + case NS_STYLE_LIST_STYLE_CIRCLE: + case NS_STYLE_LIST_STYLE_SQUARE: + aResult = ' '; + break; + + case NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL: + case NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL: + case NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL: + case NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL: + case NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL: + case NS_STYLE_LIST_STYLE_JAPANESE_FORMAL: + aResult = 0x3001; + break; + + case NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL: + case NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL: + case NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL: + aResult.AssignLiteral(MOZ_UTF16(", ")); + break; + + default: + aResult.AssignLiteral(MOZ_UTF16(". ")); + break; + } } // XXX stolen from nsBlockFrame.cpp static const char16_t kDiscCharacter = 0x2022; static const char16_t kCircleCharacter = 0x25e6; -static const char16_t kSquareCharacter = 0x25aa; +static const char16_t kSquareCharacter = 0x25fe; /* virtual */ void BuiltinCounterStyle::GetSpokenCounterText(CounterValue aOrdinal, @@ -321,6 +692,19 @@ BuiltinCounterStyle::IsBullet() } } +static const char16_t gJapaneseNegative[] = { + 0x30de, 0x30a4, 0x30ca, 0x30b9, 0x0000 +}; +static const char16_t gKoreanNegative[] = { + 0xb9c8, 0xc774, 0xb108, 0xc2a4, 0x0020, 0x0000 +}; +static const char16_t gSimpChineseNegative[] = { + 0x8d1f, 0x0000 +}; +static const char16_t gTradChineseNegative[] = { + 0x8ca0, 0x0000 +}; + /* virtual */ void BuiltinCounterStyle::GetNegative(NegativeType& aResult) { @@ -483,16 +867,59 @@ BuiltinCounterStyle::GetInitialCounterText(CounterValue aOrdinal, nsSubstring& aResult, bool& aIsRTL) { - // Since nsBulletFrame::AppendCounterText use nsString& as parameter, we - // have to reassign it. - nsAutoString result; - nsBulletFrame::AppendCounterText(mStyle, aOrdinal, result, aIsRTL); - aResult = result; - // Out-of-range ordinals should have been filtered out before invoking this - // function. Since all builtin styles are defined in a continuous range, - // no extendable fallback should have happend inside the function above, - // consequently this method will always succeed. - return true; + aIsRTL = false; + switch (mStyle) { + // used by counters & extends counter-style code only + // XXX We really need to do this the same way we do list bullets. + case NS_STYLE_LIST_STYLE_NONE: + aResult.Truncate(); + return true; + case NS_STYLE_LIST_STYLE_DISC: + aResult.Assign(kDiscCharacter); + return true; + case NS_STYLE_LIST_STYLE_CIRCLE: + aResult.Assign(kCircleCharacter); + return true; + case NS_STYLE_LIST_STYLE_SQUARE: + aResult.Assign(kSquareCharacter); + return true; + + case NS_STYLE_LIST_STYLE_DECIMAL: + return DecimalToText(aOrdinal, aResult); + + case NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL: + return CJKIdeographicToText(aOrdinal, aResult, gDataTradChineseInformal); + case NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL: + return CJKIdeographicToText(aOrdinal, aResult, gDataTradChineseFormal); + case NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL: + return CJKIdeographicToText(aOrdinal, aResult, gDataSimpChineseInformal); + case NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL: + return CJKIdeographicToText(aOrdinal, aResult, gDataSimpChineseFormal); + case NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL: + return CJKIdeographicToText(aOrdinal, aResult, gDataJapaneseInformal); + case NS_STYLE_LIST_STYLE_JAPANESE_FORMAL: + return CJKIdeographicToText(aOrdinal, aResult, gDataJapaneseFormal); + case NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL: + return CJKIdeographicToText(aOrdinal, aResult, gDataKoreanHangulFormal); + case NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL: + return CJKIdeographicToText(aOrdinal, aResult, gDataKoreanHanjaInformal); + case NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL: + return CJKIdeographicToText(aOrdinal, aResult, gDataKoreanHanjaFormal); + + case NS_STYLE_LIST_STYLE_HEBREW: + aIsRTL = true; + return HebrewToText(aOrdinal, aResult); + + case NS_STYLE_LIST_STYLE_MOZ_TAMIL: + return TamilToText(aOrdinal, aResult); + + case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_NUMERIC: + return EthiopicToText(aOrdinal, aResult); + + default: + NS_NOTREACHED("Unknown builtin counter style"); + return false; + } } class DependentBuiltinCounterStyle MOZ_FINAL : public BuiltinCounterStyle @@ -1313,10 +1740,7 @@ CounterStyle::GetSpokenCounterText(CounterValue aOrdinal, aIsBullet = true; break; case NS_STYLE_COUNTER_SPEAKAS_NUMBERS: - // use decimal to generate numeric text - // XXX change to DecimalToText after moving it here - CounterStyleManager::GetDecimalStyle()-> - GetCounterText(aOrdinal, aResult, isRTL); + DecimalToText(aOrdinal, aResult); break; case NS_STYLE_COUNTER_SPEAKAS_SPELL_OUT: // we currently do not actually support 'spell-out', From dc0ffd85cb1de4dc61730af04ef1d9c14286af5e Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 11 Jun 2014 21:14:00 -0400 Subject: [PATCH 11/68] Bug 966166 - Part 6: Tests for @counter-style. r=jfkthame, r=davidb --- accessible/tests/mochitest/name.js | 5 +- accessible/tests/mochitest/name/a11y.ini | 1 + .../mochitest/name/test_counterstyle.html | 153 ++++++++++ .../counter-style/dependent-builtin-ref.html | 12 + .../counter-style/dependent-builtin.html | 12 + .../descriptor-fallback-invalid-ref.html | 7 + .../descriptor-fallback-invalid.html | 13 + .../descriptor-fallback-ref.html | 32 +++ .../counter-style/descriptor-fallback.html | 34 +++ .../descriptor-negative-invalid-ref.html | 7 + .../descriptor-negative-invalid.html | 14 + .../descriptor-negative-ref.html | 14 + .../counter-style/descriptor-negative.html | 18 ++ .../descriptor-pad-invalid-ref.html | 7 + .../counter-style/descriptor-pad-invalid.html | 14 + .../counter-style/descriptor-pad-ref.html | 28 ++ .../counter-style/descriptor-pad.html | 39 +++ .../descriptor-prefix-invalid-ref.html | 7 + .../descriptor-prefix-invalid.html | 14 + .../counter-style/descriptor-prefix-ref.html | 14 + .../counter-style/descriptor-prefix.html | 23 ++ .../descriptor-range-invalid-ref.html | 7 + .../descriptor-range-invalid.html | 14 + .../counter-style/descriptor-range-ref.html | 19 ++ .../counter-style/descriptor-range.html | 14 + .../descriptor-suffix-invalid-ref.html | 7 + .../descriptor-suffix-invalid.html | 14 + .../counter-style/descriptor-suffix-ref.html | 25 ++ .../counter-style/descriptor-suffix.html | 36 +++ .../descriptor-symbols-invalid-ref.html | 14 + .../descriptor-symbols-invalid.html | 22 ++ .../counter-style/descriptor-symbols-ref.html | 13 + .../counter-style/descriptor-symbols.html | 18 ++ .../name-case-sensitivity-ref.html | 74 +++++ .../counter-style/name-case-sensitivity.html | 74 +++++ .../redefine-attr-mapping-ref.html | 52 ++++ .../counter-style/redefine-attr-mapping.html | 68 +++++ .../counter-style/redefine-builtin-ref.html | 7 + .../counter-style/redefine-builtin.html | 18 ++ layout/reftests/counter-style/ref-common.css | 13 + layout/reftests/counter-style/reftest.list | 32 +++ .../system-additive-invalid.html | 11 + .../counter-style/system-additive-ref.html | 38 +++ .../counter-style/system-additive.html | 39 +++ .../system-alphabetic-invalid.html | 19 ++ .../counter-style/system-alphabetic-ref.html | 12 + .../counter-style/system-alphabetic.html | 13 + .../system-common-invalid-ref.html | 5 + .../system-common-invalid2-ref.html | 8 + .../counter-style/system-cyclic-invalid.html | 11 + .../counter-style/system-cyclic-ref.html | 14 + .../reftests/counter-style/system-cyclic.html | 20 ++ .../system-extends-invalid-ref.html | 16 ++ .../counter-style/system-extends-invalid.html | 41 +++ .../counter-style/system-extends-ref.html | 24 ++ .../counter-style/system-extends.html | 22 ++ .../counter-style/system-fixed-invalid.html | 18 ++ .../counter-style/system-fixed-ref.html | 24 ++ .../reftests/counter-style/system-fixed.html | 22 ++ .../counter-style/system-numeric-invalid.html | 19 ++ .../counter-style/system-numeric-ref.html | 13 + .../counter-style/system-numeric.html | 13 + .../system-symbolic-invalid.html | 11 + .../counter-style/system-symbolic-ref.html | 22 ++ .../counter-style/system-symbolic.html | 22 ++ layout/reftests/counter-style/test-common.css | 19 ++ layout/reftests/reftest.list | 3 + layout/style/test/mochitest.ini | 2 + .../test/test_counter_descriptor_storage.html | 267 ++++++++++++++++++ layout/style/test/test_counter_style.html | 121 ++++++++ layout/style/test/test_rule_insertion.html | 32 +++ 71 files changed, 1908 insertions(+), 2 deletions(-) create mode 100644 accessible/tests/mochitest/name/test_counterstyle.html create mode 100644 layout/reftests/counter-style/dependent-builtin-ref.html create mode 100644 layout/reftests/counter-style/dependent-builtin.html create mode 100644 layout/reftests/counter-style/descriptor-fallback-invalid-ref.html create mode 100644 layout/reftests/counter-style/descriptor-fallback-invalid.html create mode 100644 layout/reftests/counter-style/descriptor-fallback-ref.html create mode 100644 layout/reftests/counter-style/descriptor-fallback.html create mode 100644 layout/reftests/counter-style/descriptor-negative-invalid-ref.html create mode 100644 layout/reftests/counter-style/descriptor-negative-invalid.html create mode 100644 layout/reftests/counter-style/descriptor-negative-ref.html create mode 100644 layout/reftests/counter-style/descriptor-negative.html create mode 100644 layout/reftests/counter-style/descriptor-pad-invalid-ref.html create mode 100644 layout/reftests/counter-style/descriptor-pad-invalid.html create mode 100644 layout/reftests/counter-style/descriptor-pad-ref.html create mode 100644 layout/reftests/counter-style/descriptor-pad.html create mode 100644 layout/reftests/counter-style/descriptor-prefix-invalid-ref.html create mode 100644 layout/reftests/counter-style/descriptor-prefix-invalid.html create mode 100644 layout/reftests/counter-style/descriptor-prefix-ref.html create mode 100644 layout/reftests/counter-style/descriptor-prefix.html create mode 100644 layout/reftests/counter-style/descriptor-range-invalid-ref.html create mode 100644 layout/reftests/counter-style/descriptor-range-invalid.html create mode 100644 layout/reftests/counter-style/descriptor-range-ref.html create mode 100644 layout/reftests/counter-style/descriptor-range.html create mode 100644 layout/reftests/counter-style/descriptor-suffix-invalid-ref.html create mode 100644 layout/reftests/counter-style/descriptor-suffix-invalid.html create mode 100644 layout/reftests/counter-style/descriptor-suffix-ref.html create mode 100644 layout/reftests/counter-style/descriptor-suffix.html create mode 100644 layout/reftests/counter-style/descriptor-symbols-invalid-ref.html create mode 100644 layout/reftests/counter-style/descriptor-symbols-invalid.html create mode 100644 layout/reftests/counter-style/descriptor-symbols-ref.html create mode 100644 layout/reftests/counter-style/descriptor-symbols.html create mode 100644 layout/reftests/counter-style/name-case-sensitivity-ref.html create mode 100644 layout/reftests/counter-style/name-case-sensitivity.html create mode 100644 layout/reftests/counter-style/redefine-attr-mapping-ref.html create mode 100644 layout/reftests/counter-style/redefine-attr-mapping.html create mode 100644 layout/reftests/counter-style/redefine-builtin-ref.html create mode 100644 layout/reftests/counter-style/redefine-builtin.html create mode 100644 layout/reftests/counter-style/ref-common.css create mode 100644 layout/reftests/counter-style/reftest.list create mode 100644 layout/reftests/counter-style/system-additive-invalid.html create mode 100644 layout/reftests/counter-style/system-additive-ref.html create mode 100644 layout/reftests/counter-style/system-additive.html create mode 100644 layout/reftests/counter-style/system-alphabetic-invalid.html create mode 100644 layout/reftests/counter-style/system-alphabetic-ref.html create mode 100644 layout/reftests/counter-style/system-alphabetic.html create mode 100644 layout/reftests/counter-style/system-common-invalid-ref.html create mode 100644 layout/reftests/counter-style/system-common-invalid2-ref.html create mode 100644 layout/reftests/counter-style/system-cyclic-invalid.html create mode 100644 layout/reftests/counter-style/system-cyclic-ref.html create mode 100644 layout/reftests/counter-style/system-cyclic.html create mode 100644 layout/reftests/counter-style/system-extends-invalid-ref.html create mode 100644 layout/reftests/counter-style/system-extends-invalid.html create mode 100644 layout/reftests/counter-style/system-extends-ref.html create mode 100644 layout/reftests/counter-style/system-extends.html create mode 100644 layout/reftests/counter-style/system-fixed-invalid.html create mode 100644 layout/reftests/counter-style/system-fixed-ref.html create mode 100644 layout/reftests/counter-style/system-fixed.html create mode 100644 layout/reftests/counter-style/system-numeric-invalid.html create mode 100644 layout/reftests/counter-style/system-numeric-ref.html create mode 100644 layout/reftests/counter-style/system-numeric.html create mode 100644 layout/reftests/counter-style/system-symbolic-invalid.html create mode 100644 layout/reftests/counter-style/system-symbolic-ref.html create mode 100644 layout/reftests/counter-style/system-symbolic.html create mode 100644 layout/reftests/counter-style/test-common.css create mode 100644 layout/style/test/test_counter_descriptor_storage.html create mode 100644 layout/style/test/test_counter_style.html diff --git a/accessible/tests/mochitest/name.js b/accessible/tests/mochitest/name.js index c8a940c3bb3..8d82909058a 100644 --- a/accessible/tests/mochitest/name.js +++ b/accessible/tests/mochitest/name.js @@ -1,7 +1,7 @@ /** * Test accessible name for the given accessible identifier. */ -function testName(aAccOrElmOrID, aName, aMsg) +function testName(aAccOrElmOrID, aName, aMsg, aTodo) { var msg = aMsg ? aMsg : ""; @@ -9,9 +9,10 @@ function testName(aAccOrElmOrID, aName, aMsg) if (!acc) return; + var func = aTodo ? todo_is : is; var txtID = prettyName(aAccOrElmOrID); try { - is(acc.name, aName, msg + "Wrong name of the accessible for " + txtID); + func(acc.name, aName, msg + "Wrong name of the accessible for " + txtID); } catch (e) { ok(false, msg + "Can't get name of the accessible for " + txtID); } diff --git a/accessible/tests/mochitest/name/a11y.ini b/accessible/tests/mochitest/name/a11y.ini index b8fa3ec26d0..601e9af9a08 100644 --- a/accessible/tests/mochitest/name/a11y.ini +++ b/accessible/tests/mochitest/name/a11y.ini @@ -6,6 +6,7 @@ support-files = markuprules.xml [test_browserui.xul] +[test_counterstyle.html] [test_general.html] [test_general.xul] [test_link.html] diff --git a/accessible/tests/mochitest/name/test_counterstyle.html b/accessible/tests/mochitest/name/test_counterstyle.html new file mode 100644 index 00000000000..506cea69aee --- /dev/null +++ b/accessible/tests/mochitest/name/test_counterstyle.html @@ -0,0 +1,153 @@ + + + + nsIAccessible::name calculation for @counter-style + + + + + + + + + + + + + + + + + Bug 966166 + + +
    + + + + + diff --git a/layout/reftests/counter-style/dependent-builtin-ref.html b/layout/reftests/counter-style/dependent-builtin-ref.html new file mode 100644 index 00000000000..5ec305c5295 --- /dev/null +++ b/layout/reftests/counter-style/dependent-builtin-ref.html @@ -0,0 +1,12 @@ + + +
    一千、
    +
    一千零一、
    +
    一千零二、
    +
    一千零三、
    +
    一千零四、
    +
    一〇〇五、
    +
    一〇〇六、
    +
    一〇〇七、
    +
    一〇〇八、
    +
    一〇〇九、
    diff --git a/layout/reftests/counter-style/dependent-builtin.html b/layout/reftests/counter-style/dependent-builtin.html new file mode 100644 index 00000000000..999bfc33b7a --- /dev/null +++ b/layout/reftests/counter-style/dependent-builtin.html @@ -0,0 +1,12 @@ + + + +
      +
    1. +
    2. +
    diff --git a/layout/reftests/counter-style/descriptor-fallback-invalid-ref.html b/layout/reftests/counter-style/descriptor-fallback-invalid-ref.html new file mode 100644 index 00000000000..e739bd08d4c --- /dev/null +++ b/layout/reftests/counter-style/descriptor-fallback-invalid-ref.html @@ -0,0 +1,7 @@ + + +
    00. 
    +
    A. 
    +
    B. 
    +
    C. 
    +
    D. 
    diff --git a/layout/reftests/counter-style/descriptor-fallback-invalid.html b/layout/reftests/counter-style/descriptor-fallback-invalid.html new file mode 100644 index 00000000000..e75cf19068e --- /dev/null +++ b/layout/reftests/counter-style/descriptor-fallback-invalid.html @@ -0,0 +1,13 @@ + + + +
      +
    1. +
    diff --git a/layout/reftests/counter-style/descriptor-fallback-ref.html b/layout/reftests/counter-style/descriptor-fallback-ref.html new file mode 100644 index 00000000000..090afcb8ee5 --- /dev/null +++ b/layout/reftests/counter-style/descriptor-fallback-ref.html @@ -0,0 +1,32 @@ + + + +
    a. 
    +
    b. 
    +
    c. 
    +
    d. 
    +
    e. 
    +
    f. 
    +
    7. 
    +
    8. 
    +
    9. 
    + +
    a. 
    +
    b. 
    +
    c. 
    +
    d. 
    +
    e. 
    +
    f. 
    +
    7. 
    +
    8. 
    +
    9. 
    + +
    a. 
    +
    b. 
    +
    c. 
    +
    d. 
    +
    e. 
    +
    f. 
    +
    g. 
    +
    h. 
    +
    i. 
    diff --git a/layout/reftests/counter-style/descriptor-fallback.html b/layout/reftests/counter-style/descriptor-fallback.html new file mode 100644 index 00000000000..deeccd316d0 --- /dev/null +++ b/layout/reftests/counter-style/descriptor-fallback.html @@ -0,0 +1,34 @@ + + + +
      +
    1. +
    2. +
    3. +
    +
      +
    1. +
    2. +
    3. +
    +
      +
    1. +
    2. +
    3. +
    diff --git a/layout/reftests/counter-style/descriptor-negative-invalid-ref.html b/layout/reftests/counter-style/descriptor-negative-invalid-ref.html new file mode 100644 index 00000000000..1f9a17eaae6 --- /dev/null +++ b/layout/reftests/counter-style/descriptor-negative-invalid-ref.html @@ -0,0 +1,7 @@ + + +
    !2. 
    +
    !1. 
    +
    0. 
    +
    1. 
    +
    2. 
    diff --git a/layout/reftests/counter-style/descriptor-negative-invalid.html b/layout/reftests/counter-style/descriptor-negative-invalid.html new file mode 100644 index 00000000000..e7f93ff081e --- /dev/null +++ b/layout/reftests/counter-style/descriptor-negative-invalid.html @@ -0,0 +1,14 @@ + + + +
      +
    1. +
    diff --git a/layout/reftests/counter-style/descriptor-negative-ref.html b/layout/reftests/counter-style/descriptor-negative-ref.html new file mode 100644 index 00000000000..447e9c4bc9f --- /dev/null +++ b/layout/reftests/counter-style/descriptor-negative-ref.html @@ -0,0 +1,14 @@ + + + +
    ⁻2. 
    +
    ⁻1. 
    +
    0. 
    +
    1. 
    +
    2. 
    + +
    (2). 
    +
    (1). 
    +
    0. 
    +
    1. 
    +
    2. 
    diff --git a/layout/reftests/counter-style/descriptor-negative.html b/layout/reftests/counter-style/descriptor-negative.html new file mode 100644 index 00000000000..f55f5699ff4 --- /dev/null +++ b/layout/reftests/counter-style/descriptor-negative.html @@ -0,0 +1,18 @@ + + + +
      +
    1. +
    +
      +
    1. +
    diff --git a/layout/reftests/counter-style/descriptor-pad-invalid-ref.html b/layout/reftests/counter-style/descriptor-pad-invalid-ref.html new file mode 100644 index 00000000000..d54cd872341 --- /dev/null +++ b/layout/reftests/counter-style/descriptor-pad-invalid-ref.html @@ -0,0 +1,7 @@ + + +
    001. 
    +
    002. 
    +
    003. 
    +
    004. 
    +
    005. 
    diff --git a/layout/reftests/counter-style/descriptor-pad-invalid.html b/layout/reftests/counter-style/descriptor-pad-invalid.html new file mode 100644 index 00000000000..45ccf9e790c --- /dev/null +++ b/layout/reftests/counter-style/descriptor-pad-invalid.html @@ -0,0 +1,14 @@ + + + +
      +
    1. +
    diff --git a/layout/reftests/counter-style/descriptor-pad-ref.html b/layout/reftests/counter-style/descriptor-pad-ref.html new file mode 100644 index 00000000000..e817f71c2fa --- /dev/null +++ b/layout/reftests/counter-style/descriptor-pad-ref.html @@ -0,0 +1,28 @@ + + + +
    -III. 
    +
    -*II. 
    +
    -**I. 
    +
    0. 
    +
    **I. 
    +
    *II. 
    +
    III. 
    +
    *IV. 
    +
    **V. 
    +
    6. 
    + +
    (002). 
    +
    (001). 
    +
    000. 
    +
    001. 
    +
    002. 
    + +
    ooā
    +
    ooá
    +
    oāá
    +
    oǎà
    +
    āáǎ
    +
    àāá
    + +
    001. 
    diff --git a/layout/reftests/counter-style/descriptor-pad.html b/layout/reftests/counter-style/descriptor-pad.html new file mode 100644 index 00000000000..62b6a1ca143 --- /dev/null +++ b/layout/reftests/counter-style/descriptor-pad.html @@ -0,0 +1,39 @@ + + + +
      +
    1. +
    2. +
    +
      +
    1. +
    +
      +
    1. +
    2. +
    3. +
    +
      +
    1. +
    diff --git a/layout/reftests/counter-style/descriptor-prefix-invalid-ref.html b/layout/reftests/counter-style/descriptor-prefix-invalid-ref.html new file mode 100644 index 00000000000..abd4f70abc9 --- /dev/null +++ b/layout/reftests/counter-style/descriptor-prefix-invalid-ref.html @@ -0,0 +1,7 @@ + + +
    #-2. 
    +
    #-1. 
    +
    #0. 
    +
    #1. 
    +
    #2. 
    diff --git a/layout/reftests/counter-style/descriptor-prefix-invalid.html b/layout/reftests/counter-style/descriptor-prefix-invalid.html new file mode 100644 index 00000000000..2e4b32372e8 --- /dev/null +++ b/layout/reftests/counter-style/descriptor-prefix-invalid.html @@ -0,0 +1,14 @@ + + + +
      +
    1. +
    diff --git a/layout/reftests/counter-style/descriptor-prefix-ref.html b/layout/reftests/counter-style/descriptor-prefix-ref.html new file mode 100644 index 00000000000..b1e4a37cebb --- /dev/null +++ b/layout/reftests/counter-style/descriptor-prefix-ref.html @@ -0,0 +1,14 @@ + + + +
    Appendix -2. 
    +
    Appendix -1. 
    +
    Appendix 0. 
    +
    Appendix I. 
    +
    Appendix II. 
    + +

    -2

    +

    -1

    +

    0

    +

    I

    +

    II

    diff --git a/layout/reftests/counter-style/descriptor-prefix.html b/layout/reftests/counter-style/descriptor-prefix.html new file mode 100644 index 00000000000..805115498fa --- /dev/null +++ b/layout/reftests/counter-style/descriptor-prefix.html @@ -0,0 +1,23 @@ + + + +
      +
    1. +
    +
    +

    +

    diff --git a/layout/reftests/counter-style/descriptor-range-invalid-ref.html b/layout/reftests/counter-style/descriptor-range-invalid-ref.html new file mode 100644 index 00000000000..13cb14c6ffe --- /dev/null +++ b/layout/reftests/counter-style/descriptor-range-invalid-ref.html @@ -0,0 +1,7 @@ + + +
    a. 
    +
    b. 
    +
    3. 
    +
    4. 
    +
    5. 
    diff --git a/layout/reftests/counter-style/descriptor-range-invalid.html b/layout/reftests/counter-style/descriptor-range-invalid.html new file mode 100644 index 00000000000..34a21998a04 --- /dev/null +++ b/layout/reftests/counter-style/descriptor-range-invalid.html @@ -0,0 +1,14 @@ + + + +
      +
    1. +
    diff --git a/layout/reftests/counter-style/descriptor-range-ref.html b/layout/reftests/counter-style/descriptor-range-ref.html new file mode 100644 index 00000000000..10dc5921552 --- /dev/null +++ b/layout/reftests/counter-style/descriptor-range-ref.html @@ -0,0 +1,19 @@ + + +
    -III. 
    +
    -2. 
    +
    -I. 
    +
    0. 
    +
    I. 
    +
    II. 
    +
    3. 
    +
    IV. 
    +
    5. 
    +
    6. 
    +
    VII. 
    +
    VIII. 
    +
    IX. 
    +
    10. 
    +
    XI. 
    +
    MMMCMXCIX. 
    +
    MMMM. 
    diff --git a/layout/reftests/counter-style/descriptor-range.html b/layout/reftests/counter-style/descriptor-range.html new file mode 100644 index 00000000000..9d57f5d1a77 --- /dev/null +++ b/layout/reftests/counter-style/descriptor-range.html @@ -0,0 +1,14 @@ + + + +
      +
    1. +
    2. +
    3. +
    4. +
    diff --git a/layout/reftests/counter-style/descriptor-suffix-invalid-ref.html b/layout/reftests/counter-style/descriptor-suffix-invalid-ref.html new file mode 100644 index 00000000000..5213feedd82 --- /dev/null +++ b/layout/reftests/counter-style/descriptor-suffix-invalid-ref.html @@ -0,0 +1,7 @@ + + +
    -2,
    +
    -1,
    +
    0,
    +
    1,
    +
    2,
    diff --git a/layout/reftests/counter-style/descriptor-suffix-invalid.html b/layout/reftests/counter-style/descriptor-suffix-invalid.html new file mode 100644 index 00000000000..4918226ca9a --- /dev/null +++ b/layout/reftests/counter-style/descriptor-suffix-invalid.html @@ -0,0 +1,14 @@ + + + +
      +
    1. +
    diff --git a/layout/reftests/counter-style/descriptor-suffix-ref.html b/layout/reftests/counter-style/descriptor-suffix-ref.html new file mode 100644 index 00000000000..1fc40a371fa --- /dev/null +++ b/layout/reftests/counter-style/descriptor-suffix-ref.html @@ -0,0 +1,25 @@ + + + +
    -2,-2
    +
    -1,-1
    +
    0,0
    +
    1,1
    +
    2,2
    + +
    -2、-2
    +
    -1、-1
    +
    0、0
    +
    1、1
    +
    2、2
    + +
    -2
    +
    -1
    +
    0
    +
    1
    +
    2
    diff --git a/layout/reftests/counter-style/descriptor-suffix.html b/layout/reftests/counter-style/descriptor-suffix.html new file mode 100644 index 00000000000..6b01c7cbeff --- /dev/null +++ b/layout/reftests/counter-style/descriptor-suffix.html @@ -0,0 +1,36 @@ + + +
      +
    1. -2
    2. -1
    3. 0
    4. 1
    5. 2 +
    +
      +
    1. -2
    2. -1
    3. 0
    4. 1
    5. 2 +
    +
    +

    +

    diff --git a/layout/reftests/counter-style/descriptor-symbols-invalid-ref.html b/layout/reftests/counter-style/descriptor-symbols-invalid-ref.html new file mode 100644 index 00000000000..fc485c5d44e --- /dev/null +++ b/layout/reftests/counter-style/descriptor-symbols-invalid-ref.html @@ -0,0 +1,14 @@ + + + +
    a. 
    +
    b. 
    +
    c. 
    +
    4. 
    +
    5. 
    + +
    a. 
    +
    b. 
    +
    c. 
    +
    ca. 
    +
    cb. 
    diff --git a/layout/reftests/counter-style/descriptor-symbols-invalid.html b/layout/reftests/counter-style/descriptor-symbols-invalid.html new file mode 100644 index 00000000000..d1482145ee4 --- /dev/null +++ b/layout/reftests/counter-style/descriptor-symbols-invalid.html @@ -0,0 +1,22 @@ + + + +
      +
    1. +
    +
      +
    1. +
    diff --git a/layout/reftests/counter-style/descriptor-symbols-ref.html b/layout/reftests/counter-style/descriptor-symbols-ref.html new file mode 100644 index 00000000000..914faba60ef --- /dev/null +++ b/layout/reftests/counter-style/descriptor-symbols-ref.html @@ -0,0 +1,13 @@ + + + +
    a. 
    +
    b. 
    +
    c. 
    + +
    a. 
    +
    b. 
    +
    c. 
    +
    d. 
    +
    e. 
    +
    f. 
    diff --git a/layout/reftests/counter-style/descriptor-symbols.html b/layout/reftests/counter-style/descriptor-symbols.html new file mode 100644 index 00000000000..a1028285e88 --- /dev/null +++ b/layout/reftests/counter-style/descriptor-symbols.html @@ -0,0 +1,18 @@ + + + +
      +
    1. +
    +
      +
    1. +
    diff --git a/layout/reftests/counter-style/name-case-sensitivity-ref.html b/layout/reftests/counter-style/name-case-sensitivity-ref.html new file mode 100644 index 00000000000..72b1ffde073 --- /dev/null +++ b/layout/reftests/counter-style/name-case-sensitivity-ref.html @@ -0,0 +1,74 @@ + + + + +
    +
    +
    +
    + + +
    +
    +
    +
    + + + +
    +

    +

    +

    +

    +
    + + + +
    +

    +

    +

    +

    +
    + + +
    +
    +
    +
    diff --git a/layout/reftests/counter-style/name-case-sensitivity.html b/layout/reftests/counter-style/name-case-sensitivity.html new file mode 100644 index 00000000000..d9703b1aeb0 --- /dev/null +++ b/layout/reftests/counter-style/name-case-sensitivity.html @@ -0,0 +1,74 @@ + + + + +
    +
    +
    +
    + + +
    +
    +
    +
    + + + +
    +

    +

    +

    +

    +
    + + + +
    +

    +

    +

    +

    +
    + + +
    +
    +
    +
    diff --git a/layout/reftests/counter-style/redefine-attr-mapping-ref.html b/layout/reftests/counter-style/redefine-attr-mapping-ref.html new file mode 100644 index 00000000000..00da621e790 --- /dev/null +++ b/layout/reftests/counter-style/redefine-attr-mapping-ref.html @@ -0,0 +1,52 @@ + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
      +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    diff --git a/layout/reftests/counter-style/redefine-attr-mapping.html b/layout/reftests/counter-style/redefine-attr-mapping.html new file mode 100644 index 00000000000..9bf262ecc54 --- /dev/null +++ b/layout/reftests/counter-style/redefine-attr-mapping.html @@ -0,0 +1,68 @@ + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
      +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    diff --git a/layout/reftests/counter-style/redefine-builtin-ref.html b/layout/reftests/counter-style/redefine-builtin-ref.html new file mode 100644 index 00000000000..419b53d8650 --- /dev/null +++ b/layout/reftests/counter-style/redefine-builtin-ref.html @@ -0,0 +1,7 @@ + + +
      +
    1. foo +
    2. bar +
    3. +
    diff --git a/layout/reftests/counter-style/redefine-builtin.html b/layout/reftests/counter-style/redefine-builtin.html new file mode 100644 index 00000000000..60117d7a6ad --- /dev/null +++ b/layout/reftests/counter-style/redefine-builtin.html @@ -0,0 +1,18 @@ + + + +
      +
    1. foo +
    2. bar +
    3. +
    diff --git a/layout/reftests/counter-style/ref-common.css b/layout/reftests/counter-style/ref-common.css new file mode 100644 index 00000000000..57039fa3c0a --- /dev/null +++ b/layout/reftests/counter-style/ref-common.css @@ -0,0 +1,13 @@ +body { + /* to match ua.css, see bug 1020143 */ + -moz-font-feature-settings: "tnum"; + font-feature-settings: "tnum"; +} +div, p { + padding: 0; margin: 0; + line-height: 150%; + float: left; +} +p { + padding-right: .5em; +} diff --git a/layout/reftests/counter-style/reftest.list b/layout/reftests/counter-style/reftest.list new file mode 100644 index 00000000000..451f2e26cd6 --- /dev/null +++ b/layout/reftests/counter-style/reftest.list @@ -0,0 +1,32 @@ +== system-cyclic.html system-cyclic-ref.html +== system-fixed.html system-fixed-ref.html +== system-symbolic.html system-symbolic-ref.html +== system-alphabetic.html system-alphabetic-ref.html +== system-numeric.html system-numeric-ref.html +== system-additive.html system-additive-ref.html +== system-extends.html system-extends-ref.html +== system-cyclic-invalid.html system-common-invalid-ref.html +== system-fixed-invalid.html system-common-invalid2-ref.html +== system-symbolic-invalid.html system-common-invalid-ref.html +== system-alphabetic-invalid.html system-common-invalid2-ref.html +== system-numeric-invalid.html system-common-invalid2-ref.html +== system-additive-invalid.html system-common-invalid-ref.html +== system-extends-invalid.html system-extends-invalid-ref.html +== descriptor-negative.html descriptor-negative-ref.html +== descriptor-prefix.html descriptor-prefix-ref.html +fails-if(B2G) == descriptor-suffix.html descriptor-suffix-ref.html # B2G kerning +== descriptor-range.html descriptor-range-ref.html +== descriptor-pad.html descriptor-pad-ref.html +== descriptor-fallback.html descriptor-fallback-ref.html +== descriptor-symbols.html descriptor-symbols-ref.html +== descriptor-negative-invalid.html descriptor-negative-invalid-ref.html +== descriptor-prefix-invalid.html descriptor-prefix-invalid-ref.html +== descriptor-suffix-invalid.html descriptor-suffix-invalid-ref.html +== descriptor-range-invalid.html descriptor-range-invalid-ref.html +== descriptor-pad-invalid.html descriptor-pad-invalid-ref.html +== descriptor-fallback.html descriptor-fallback-ref.html +== descriptor-symbols-invalid.html descriptor-symbols-invalid-ref.html +== name-case-sensitivity.html name-case-sensitivity-ref.html +== dependent-builtin.html dependent-builtin-ref.html +== redefine-builtin.html redefine-builtin-ref.html +== redefine-attr-mapping.html redefine-attr-mapping-ref.html diff --git a/layout/reftests/counter-style/system-additive-invalid.html b/layout/reftests/counter-style/system-additive-invalid.html new file mode 100644 index 00000000000..1ed907b1c13 --- /dev/null +++ b/layout/reftests/counter-style/system-additive-invalid.html @@ -0,0 +1,11 @@ + + + +
      +
    1. foo
    2. bar
    3. foo
    4. bar +
    diff --git a/layout/reftests/counter-style/system-additive-ref.html b/layout/reftests/counter-style/system-additive-ref.html new file mode 100644 index 00000000000..bdf05a5e578 --- /dev/null +++ b/layout/reftests/counter-style/system-additive-ref.html @@ -0,0 +1,38 @@ + + + +
    -2
    +
    -1
    +
    0
    +
    +
    +
    +
    +
    +
    +
    ⚅⚀
    +
    ⚅⚃
    +
    ⚅⚄
    +
    ⚅⚅
    +
    ⚅⚅⚀
    +
    +
    1000
    + +
    -2
    +
    -1
    +
    +
    +
    + +
    1. 
    +
    b. 
    +
    a. 
    +
    4. 
    +
    ab. 
    + +
    +
    100. 
    diff --git a/layout/reftests/counter-style/system-additive.html b/layout/reftests/counter-style/system-additive.html new file mode 100644 index 00000000000..f3577a93e4c --- /dev/null +++ b/layout/reftests/counter-style/system-additive.html @@ -0,0 +1,39 @@ + + + +
      +
    1. +
    2. +
    3. +
    4. +
    5. +
    +
      +
    1. +
    +
      +
    1. +
    +
      +
    1. +
    2. +
    diff --git a/layout/reftests/counter-style/system-alphabetic-invalid.html b/layout/reftests/counter-style/system-alphabetic-invalid.html new file mode 100644 index 00000000000..a37eefed353 --- /dev/null +++ b/layout/reftests/counter-style/system-alphabetic-invalid.html @@ -0,0 +1,19 @@ + + + +
      +
    1. foo
    2. bar
    3. foo
    4. bar +
    +
      +
    1. foo
    2. bar
    3. foo
    4. bar +
    diff --git a/layout/reftests/counter-style/system-alphabetic-ref.html b/layout/reftests/counter-style/system-alphabetic-ref.html new file mode 100644 index 00000000000..9a039cc1708 --- /dev/null +++ b/layout/reftests/counter-style/system-alphabetic-ref.html @@ -0,0 +1,12 @@ + + +
    -2
    +
    -1
    +
    0
    +
    +
    +
    ⚪⚪
    +
    ⚪⚫
    +
    ⚫⚪
    +
    ⚫⚫
    +
    ⚪⚪⚪
    diff --git a/layout/reftests/counter-style/system-alphabetic.html b/layout/reftests/counter-style/system-alphabetic.html new file mode 100644 index 00000000000..25b2c49b542 --- /dev/null +++ b/layout/reftests/counter-style/system-alphabetic.html @@ -0,0 +1,13 @@ + + + +
      +
    1. +
    2. +
    diff --git a/layout/reftests/counter-style/system-common-invalid-ref.html b/layout/reftests/counter-style/system-common-invalid-ref.html new file mode 100644 index 00000000000..b2502514f7e --- /dev/null +++ b/layout/reftests/counter-style/system-common-invalid-ref.html @@ -0,0 +1,5 @@ + + +
      +
    1. foo
    2. bar
    3. foo
    4. bar +
    diff --git a/layout/reftests/counter-style/system-common-invalid2-ref.html b/layout/reftests/counter-style/system-common-invalid2-ref.html new file mode 100644 index 00000000000..aad389e03e3 --- /dev/null +++ b/layout/reftests/counter-style/system-common-invalid2-ref.html @@ -0,0 +1,8 @@ + + +
      +
    1. foo
    2. bar
    3. foo
    4. bar +
    +
      +
    1. foo
    2. bar
    3. foo
    4. bar +
    diff --git a/layout/reftests/counter-style/system-cyclic-invalid.html b/layout/reftests/counter-style/system-cyclic-invalid.html new file mode 100644 index 00000000000..0f0c793550f --- /dev/null +++ b/layout/reftests/counter-style/system-cyclic-invalid.html @@ -0,0 +1,11 @@ + + + +
      +
    1. foo
    2. bar
    3. foo
    4. bar +
    diff --git a/layout/reftests/counter-style/system-cyclic-ref.html b/layout/reftests/counter-style/system-cyclic-ref.html new file mode 100644 index 00000000000..522d93860e6 --- /dev/null +++ b/layout/reftests/counter-style/system-cyclic-ref.html @@ -0,0 +1,14 @@ + + + +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    diff --git a/layout/reftests/counter-style/system-cyclic.html b/layout/reftests/counter-style/system-cyclic.html new file mode 100644 index 00000000000..e7331bd1eb9 --- /dev/null +++ b/layout/reftests/counter-style/system-cyclic.html @@ -0,0 +1,20 @@ + + + +
      +
    1. +
    +
      +
    1. +
    diff --git a/layout/reftests/counter-style/system-extends-invalid-ref.html b/layout/reftests/counter-style/system-extends-invalid-ref.html new file mode 100644 index 00000000000..23c5589f930 --- /dev/null +++ b/layout/reftests/counter-style/system-extends-invalid-ref.html @@ -0,0 +1,16 @@ + + + + +
    a1b
    +
    2b
    +
    c3. 
    +
    d4. 
    +
    e5. 
    +
      +
    1. foo
    2. bar +
    diff --git a/layout/reftests/counter-style/system-extends-invalid.html b/layout/reftests/counter-style/system-extends-invalid.html new file mode 100644 index 00000000000..ecd4fed0373 --- /dev/null +++ b/layout/reftests/counter-style/system-extends-invalid.html @@ -0,0 +1,41 @@ + + + +
      +
    1. +
    2. +
    3. +
    4. +
    5. +
    6. foo +
    7. bar +
    diff --git a/layout/reftests/counter-style/system-extends-ref.html b/layout/reftests/counter-style/system-extends-ref.html new file mode 100644 index 00000000000..5eefe70d7c6 --- /dev/null +++ b/layout/reftests/counter-style/system-extends-ref.html @@ -0,0 +1,24 @@ + + + +
    Chapter -2. 
    +
    Chapter -1. 
    +
    Chapter 0. 
    +
    Chapter I. 
    +
    Chapter II. 
    +
    Chapter III. 
    +
    Chapter IV. 
    +
    Chapter V. 
    +
    Chapter 6. 
    +
    Chapter 7. 
    + +
    Section -2. 
    +
    Section -1. 
    +
    Section 0. 
    +
    Section I. 
    +
    Section II. 
    +
    Section III. 
    +
    Section IV. 
    +
    Section V. 
    +
    Section VI. 
    +
    Section 7. 
    diff --git a/layout/reftests/counter-style/system-extends.html b/layout/reftests/counter-style/system-extends.html new file mode 100644 index 00000000000..cb51626d37b --- /dev/null +++ b/layout/reftests/counter-style/system-extends.html @@ -0,0 +1,22 @@ + + + +
      +
    1. +
    2. +
    +
      +
    1. +
    2. +
    diff --git a/layout/reftests/counter-style/system-fixed-invalid.html b/layout/reftests/counter-style/system-fixed-invalid.html new file mode 100644 index 00000000000..848e4f9f21c --- /dev/null +++ b/layout/reftests/counter-style/system-fixed-invalid.html @@ -0,0 +1,18 @@ + + + +
      +
    1. foo
    2. bar
    3. foo
    4. bar +
    +
      +
    1. foo
    2. bar
    3. foo
    4. bar +
    diff --git a/layout/reftests/counter-style/system-fixed-ref.html b/layout/reftests/counter-style/system-fixed-ref.html new file mode 100644 index 00000000000..14cbc53e919 --- /dev/null +++ b/layout/reftests/counter-style/system-fixed-ref.html @@ -0,0 +1,24 @@ + + + +
    -2:
    +
    -1:
    +
    0:
    +
    ◰:
    +
    ◱:
    +
    ◲:
    +
    ◳:
    +
    5:
    +
    6:
    +
    7:
    + +
    -2:
    +
    ◴:
    +
    ◵:
    +
    ◶:
    +
    ◷:
    +
    3:
    +
    4:
    +
    5:
    +
    6:
    +
    7:
    diff --git a/layout/reftests/counter-style/system-fixed.html b/layout/reftests/counter-style/system-fixed.html new file mode 100644 index 00000000000..d7d55bad81c --- /dev/null +++ b/layout/reftests/counter-style/system-fixed.html @@ -0,0 +1,22 @@ + + + +
      +
    1. +
    2. +
    +
      +
    1. +
    2. +
    diff --git a/layout/reftests/counter-style/system-numeric-invalid.html b/layout/reftests/counter-style/system-numeric-invalid.html new file mode 100644 index 00000000000..ea054d10250 --- /dev/null +++ b/layout/reftests/counter-style/system-numeric-invalid.html @@ -0,0 +1,19 @@ + + + +
      +
    1. foo
    2. bar
    3. foo
    4. bar +
    +
      +
    1. foo
    2. bar
    3. foo
    4. bar +
    diff --git a/layout/reftests/counter-style/system-numeric-ref.html b/layout/reftests/counter-style/system-numeric-ref.html new file mode 100644 index 00000000000..548ee0f39cb --- /dev/null +++ b/layout/reftests/counter-style/system-numeric-ref.html @@ -0,0 +1,13 @@ + + +
    -11. 
    +
    -10. 
    +
    -2. 
    +
    -1. 
    +
    0. 
    +
    1. 
    +
    2. 
    +
    10. 
    +
    11. 
    +
    12. 
    +
    10201. 
    diff --git a/layout/reftests/counter-style/system-numeric.html b/layout/reftests/counter-style/system-numeric.html new file mode 100644 index 00000000000..51b86b7644e --- /dev/null +++ b/layout/reftests/counter-style/system-numeric.html @@ -0,0 +1,13 @@ + + + +
      +
    1. +
    2. +
    3. +
    diff --git a/layout/reftests/counter-style/system-symbolic-invalid.html b/layout/reftests/counter-style/system-symbolic-invalid.html new file mode 100644 index 00000000000..7c9b1a3a3f0 --- /dev/null +++ b/layout/reftests/counter-style/system-symbolic-invalid.html @@ -0,0 +1,11 @@ + + + +
      +
    1. foo
    2. bar
    3. foo
    4. bar +
    diff --git a/layout/reftests/counter-style/system-symbolic-ref.html b/layout/reftests/counter-style/system-symbolic-ref.html new file mode 100644 index 00000000000..b8e1b22d2f1 --- /dev/null +++ b/layout/reftests/counter-style/system-symbolic-ref.html @@ -0,0 +1,22 @@ + + + +
    -2
    +
    -1
    +
    0
    +
    *
    +
    +
    +
    +
    **
    +
    ⁑⁑
    +
    ††
    +
    +
    1000
    + +
    +
    100. 
    diff --git a/layout/reftests/counter-style/system-symbolic.html b/layout/reftests/counter-style/system-symbolic.html new file mode 100644 index 00000000000..e608ea0bf39 --- /dev/null +++ b/layout/reftests/counter-style/system-symbolic.html @@ -0,0 +1,22 @@ + + + +
      +
    1. +
    2. +
    3. +
    4. +
    +
      +
    1. +
    2. +
    diff --git a/layout/reftests/counter-style/test-common.css b/layout/reftests/counter-style/test-common.css new file mode 100644 index 00000000000..b6f5374156f --- /dev/null +++ b/layout/reftests/counter-style/test-common.css @@ -0,0 +1,19 @@ +body { + /* to match ua.css, see bug 1020143 */ + -moz-font-feature-settings: "tnum"; + font-feature-settings: "tnum"; +} +ol, ul, section, p { + padding: 0; margin: 0; + line-height: 150%; +} +ol, ul { + list-style-position: inside; +} +li, p { + float: left; + padding: 0; +} +p { + padding-right: .5em; +} diff --git a/layout/reftests/reftest.list b/layout/reftests/reftest.list index 5be076f8100..231168402c2 100644 --- a/layout/reftests/reftest.list +++ b/layout/reftests/reftest.list @@ -140,6 +140,9 @@ include ../../content/test/reftest/reftest.list # counters/ include counters/reftest.list +# counter-style/ +include counter-style/reftest.list + # datalist include datalist/reftest.list diff --git a/layout/style/test/mochitest.ini b/layout/style/test/mochitest.ini index 9fa4a21aa54..29df6b5fe47 100644 --- a/layout/style/test/mochitest.ini +++ b/layout/style/test/mochitest.ini @@ -233,4 +233,6 @@ support-files = bug732209-css.sjs [test_bug795520.html] [test_background_blend_mode.html] [test_property_database.html] +[test_counter_style.html] +[test_counter_descriptor_storage.html] diff --git a/layout/style/test/test_counter_descriptor_storage.html b/layout/style/test/test_counter_descriptor_storage.html new file mode 100644 index 00000000000..287738dcb13 --- /dev/null +++ b/layout/style/test/test_counter_descriptor_storage.html @@ -0,0 +1,267 @@ + + + + Test for parsing, storage and serialization of CSS @counter-style descriptor values + + + + +Mozilla Bug 966166 +
    +
    +
    +
    + + diff --git a/layout/style/test/test_counter_style.html b/layout/style/test/test_counter_style.html new file mode 100644 index 00000000000..c248494f532 --- /dev/null +++ b/layout/style/test/test_counter_style.html @@ -0,0 +1,121 @@ + + + + + Test for css3-counter-style (Bug 966166) + + + + + + +Mozilla Bug 966166 +
    +

    +

    +

    +

    +
    +
    +
    + + diff --git a/layout/style/test/test_rule_insertion.html b/layout/style/test/test_rule_insertion.html index 72783048bb9..c4aefd96e66 100644 --- a/layout/style/test/test_rule_insertion.html +++ b/layout/style/test/test_rule_insertion.html @@ -23,6 +23,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=816720 #test-font { font: 16px UnlikelyFontName, serif } +

    +

    +

    + + + + + + +

    +This line has a bottom vertical align span.
    +This line has a top vertical align span. +

    + + diff --git a/layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-2-ref.html b/layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-2-ref.html new file mode 100644 index 00000000000..7a1ba472fe5 --- /dev/null +++ b/layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-2-ref.html @@ -0,0 +1,21 @@ + + + + + +

    +This line has only a bottom vertical align span.
    +This line has a top vertical align span. +

    + + diff --git a/layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-2.html b/layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-2.html new file mode 100644 index 00000000000..52d5c5b62e0 --- /dev/null +++ b/layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-2.html @@ -0,0 +1,26 @@ + + + + + + +

    +This line has only a bottom vertical align span.
    +This line has a top vertical align span. +

    + + diff --git a/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-1-ref.html b/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-1-ref.html new file mode 100644 index 00000000000..01ba4d9b6c9 --- /dev/null +++ b/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-1-ref.html @@ -0,0 +1,22 @@ + + + + + + +

    +This line has a bottom vertical align span.
    +This line has a top vertical align span. +

    + + diff --git a/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-1.html b/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-1.html new file mode 100644 index 00000000000..c285c02466b --- /dev/null +++ b/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-1.html @@ -0,0 +1,27 @@ + + + + + + + +

    +This line has a bottom vertical align span.
    +This line has a top vertical align span. +

    + + diff --git a/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-2-ref.html b/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-2-ref.html new file mode 100644 index 00000000000..fb465cce22b --- /dev/null +++ b/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-2-ref.html @@ -0,0 +1,22 @@ + + + + + + +

    +This line has only a bottom vertical align span.
    +This line has a top vertical align span. +

    + + diff --git a/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-2.html b/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-2.html new file mode 100644 index 00000000000..e48816365a8 --- /dev/null +++ b/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-2.html @@ -0,0 +1,27 @@ + + + + + + + +

    +This line has only a bottom vertical align span.
    +This line has a top vertical align span. +

    + + diff --git a/layout/reftests/text-decoration/reftest.list b/layout/reftests/text-decoration/reftest.list index d4d5cca48db..8f7e7d8a60a 100644 --- a/layout/reftests/text-decoration/reftest.list +++ b/layout/reftests/text-decoration/reftest.list @@ -4,6 +4,10 @@ skip-if(B2G) == complex-decoration-style-standards.html complex-decoration-style == decoration-color-standards.html decoration-color-standards-ref.html == decoration-style-quirks.html decoration-style-quirks-ref.html == decoration-style-standards.html decoration-style-standards-ref.html +== dynamic-underline-vertical-align-quirks-1.html dynamic-underline-vertical-align-quirks-1-ref.html +== dynamic-underline-vertical-align-standards-1.html dynamic-underline-vertical-align-standards-1-ref.html +fails == dynamic-underline-vertical-align-quirks-2.html dynamic-underline-vertical-align-quirks-2-ref.html # Bug 750917 +== dynamic-underline-vertical-align-standards-2.html dynamic-underline-vertical-align-standards-2-ref.html == line-through-style-block-solid-quirks.html line-through-style-block-quirks-ref.html != line-through-style-block-dotted-quirks.html line-through-style-block-quirks-ref.html != line-through-style-block-dashed-quirks.html line-through-style-block-quirks-ref.html From 995cc74fd1c7954c099bb45237ffd0d42c0d7973 Mon Sep 17 00:00:00 2001 From: Susanna Bowen Date: Mon, 9 Jun 2014 15:00:00 -0400 Subject: [PATCH 17/68] Bug 727125 - Update overflow areas for text frames on text-decoration change to ensure text-decoration on hover is visible. r=dbaron --- layout/base/RestyleManager.cpp | 26 ++++++++++- layout/base/RestyleManager.h | 3 ++ layout/base/nsChangeHint.h | 21 +++++---- layout/generic/nsTextFrame.cpp | 45 +++++++++++++++++--- layout/generic/nsTextFrame.h | 4 +- layout/reftests/text-decoration/reftest.list | 2 +- layout/style/nsStyleStruct.cpp | 12 ++---- layout/style/nsStyleStruct.h | 4 +- 8 files changed, 89 insertions(+), 28 deletions(-) diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index 883186dc348..7019d949ea8 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -513,6 +513,22 @@ RestyleManager::StyleChangeReflow(nsIFrame* aFrame, nsChangeHint aHint) return; } +void +RestyleManager::AddSubtreeToOverflowTracker(nsIFrame* aFrame) +{ + mOverflowChangedTracker.AddFrame( + aFrame, + OverflowChangedTracker::CHILDREN_AND_PARENT_CHANGED); + nsIFrame::ChildListIterator lists(aFrame); + for (; !lists.IsDone(); lists.Next()) { + nsFrameList::Enumerator childFrames(lists.CurrentList()); + for (; !childFrames.AtEnd(); childFrames.Next()) { + nsIFrame* child = childFrames.get(); + AddSubtreeToOverflowTracker(child); + } + } +} + NS_DECLARE_FRAME_PROPERTY(ChangeListProperty, nullptr) /** @@ -716,6 +732,7 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList) StyleChangeReflow(frame, hint); didReflowThisFrame = true; } + if (hint & (nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView | nsChangeHint_UpdateOpacityLayer | nsChangeHint_UpdateTransformLayer | nsChangeHint_ChildrenOnlyTransform)) { @@ -733,7 +750,11 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList) "nsChangeHint_UpdateOverflow should be passed too"); if (!didReflowThisFrame && (hint & (nsChangeHint_UpdateOverflow | - nsChangeHint_UpdatePostTransformOverflow))) { + nsChangeHint_UpdatePostTransformOverflow | + nsChangeHint_UpdateSubtreeOverflow))) { + if (hint & nsChangeHint_UpdateSubtreeOverflow) { + AddSubtreeToOverflowTracker(frame); + } OverflowChangedTracker::ChangeKind changeKind; if (hint & nsChangeHint_ChildrenOnlyTransform) { // The overflow areas of the child frames need to be updated: @@ -769,7 +790,8 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList) // If we have both nsChangeHint_UpdateOverflow and // nsChangeHint_UpdatePostTransformOverflow, CHILDREN_AND_PARENT_CHANGED // is selected as it is stronger. - if (hint & nsChangeHint_UpdateOverflow) { + if (hint & (nsChangeHint_UpdateOverflow | + nsChangeHint_UpdateSubtreeOverflow)) { changeKind = OverflowChangedTracker::CHILDREN_AND_PARENT_CHANGED; } else { changeKind = OverflowChangedTracker::TRANSFORM_CHANGED; diff --git a/layout/base/RestyleManager.h b/layout/base/RestyleManager.h index 9a24a43257d..d5da7903971 100644 --- a/layout/base/RestyleManager.h +++ b/layout/base/RestyleManager.h @@ -244,6 +244,9 @@ private: void StyleChangeReflow(nsIFrame* aFrame, nsChangeHint aHint); + // Recursively add all the given frame and all children to the tracker. + void AddSubtreeToOverflowTracker(nsIFrame* aFrame); + // Returns true if this function managed to successfully move a frame, and // false if it could not process the position change, and a reflow should // be performed instead. diff --git a/layout/base/nsChangeHint.h b/layout/base/nsChangeHint.h index 79d5632a620..7acc5a2437c 100644 --- a/layout/base/nsChangeHint.h +++ b/layout/base/nsChangeHint.h @@ -72,23 +72,28 @@ enum nsChangeHint { nsChangeHint_ReconstructFrame = 0x400, /** - * The frame's overflow area has changed, either through a change in its - * transform or a change in its position. Does not update any descendant + * The frame's overflow area has changed. Does not update any descendant * frames. */ nsChangeHint_UpdateOverflow = 0x800, + /** + * The overflow area of the frame and all of its descendants has changed. This + * can happen through a text-decoration change. + */ + nsChangeHint_UpdateSubtreeOverflow = 0x1000, + /** * The frame's overflow area has changed, through a change in its transform. * Does not update any descendant frames. */ - nsChangeHint_UpdatePostTransformOverflow = 0x1000, + nsChangeHint_UpdatePostTransformOverflow = 0x2000, /** * The children-only transform of an SVG frame changed, requiring the * overflow rects of the frame's immediate children to be updated. */ - nsChangeHint_ChildrenOnlyTransform = 0x2000, + nsChangeHint_ChildrenOnlyTransform = 0x4000, /** * The frame's offsets have changed, while its dimensions might have @@ -100,7 +105,7 @@ enum nsChangeHint { * nsChangeHint_UpdateOverflow in order to get the overflow areas of * the ancestors updated as well. */ - nsChangeHint_RecomputePosition = 0x4000, + nsChangeHint_RecomputePosition = 0x8000, /** * Behaves like ReconstructFrame, but only if the frame has descendants @@ -108,7 +113,7 @@ enum nsChangeHint { * has changed whether the frame is a container for fixed-pos or abs-pos * elements, but reframing is otherwise not needed. */ - nsChangeHint_AddOrRemoveTransform = 0x8000, + nsChangeHint_AddOrRemoveTransform = 0x10000, /** * This change hint has *no* change handling behavior. However, it @@ -116,13 +121,13 @@ enum nsChangeHint { * changes, and it's inherited by a child, that might require a reflow * due to the border-width change on the child. */ - nsChangeHint_BorderStyleNoneChange = 0x10000, + nsChangeHint_BorderStyleNoneChange = 0x20000, /** * SVG textPath needs to be recomputed because the path has changed. * This means that the glyph positions of the text need to be recomputed. */ - nsChangeHint_UpdateTextPath = 0x20000 + nsChangeHint_UpdateTextPath = 0x40000 // IMPORTANT NOTE: When adding new hints, consider whether you need to // add them to NS_HintsNotHandledForDescendantsIn() below. diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 76e3cb12fe1..aab6d8ba77a 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -4801,7 +4801,7 @@ GetInflationForTextDecorations(nsIFrame* aFrame, nscoord aInflationMinFontSize) void nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext, - const nsHTMLReflowState& aBlockReflowState, + nsIFrame* aBlock, PropertyProvider& aProvider, nsRect* aVisualOverflowRect, bool aIncludeTextDecorations) @@ -4814,8 +4814,8 @@ nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext, if (IsFloatingFirstLetterChild()) { // The underline/overline drawable area must be contained in the overflow // rect when this is in floating first letter frame at *both* modes. - nsIFrame* firstLetterFrame = aBlockReflowState.frame; - uint8_t decorationStyle = firstLetterFrame->StyleContext()-> + // In this case, aBlock is the ::first-letter frame. + uint8_t decorationStyle = aBlock->StyleContext()-> StyleTextReset()->GetDecorationStyle(); // If the style is none, let's include decoration line rect as solid style // since changing the style from none to solid/dotted/dashed doesn't cause @@ -4859,7 +4859,7 @@ nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext, GetTextDecorations(aPresContext, eResolvedColors, textDecs); if (textDecs.HasDecorationLines()) { nscoord inflationMinFontSize = - nsLayoutUtils::InflationMinFontSizeFor(aBlockReflowState.frame); + nsLayoutUtils::InflationMinFontSizeFor(aBlock); const nscoord width = GetSize().width; const gfxFloat appUnitsPerDevUnit = aPresContext->AppUnitsPerDevPixel(), @@ -8044,7 +8044,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth, // When we have text decorations, we don't need to compute their overflow now // because we're guaranteed to do it later // (see nsLineLayout::RelativePositionFrames) - UnionAdditionalOverflow(presContext, *aLineLayout.LineContainerRS(), + UnionAdditionalOverflow(presContext, aLineLayout.LineContainerRS()->frame, provider, &aMetrics.VisualOverflow(), false); ///////////////////////////////////////////////////////////////////// @@ -8286,7 +8286,7 @@ nsTextFrame::RecomputeOverflow(const nsHTMLReflowState& aBlockReflowState) &provider); nsRect &vis = result.VisualOverflow(); vis.UnionRect(vis, RoundOut(textMetrics.mBoundingBox) + nsPoint(0, mAscent)); - UnionAdditionalOverflow(PresContext(), aBlockReflowState, provider, + UnionAdditionalOverflow(PresContext(), aBlockReflowState.frame, provider, &vis, true); return result; } @@ -8577,3 +8577,36 @@ nsTextFrame::HasAnyNoncollapsedCharacters() int32_t skippedOffsetEnd = iter.ConvertOriginalToSkipped(offsetEnd); return skippedOffset != skippedOffsetEnd; } + +bool +nsTextFrame::UpdateOverflow() +{ + nsRect rect(nsPoint(0, 0), GetSize()); + nsOverflowAreas overflowAreas(rect, rect); + + if (GetStateBits() & NS_FRAME_FIRST_REFLOW) { + return false; + } + gfxSkipCharsIterator iter = EnsureTextRun(nsTextFrame::eInflated); + if (!mTextRun) { + return false; + } + PropertyProvider provider(this, iter, nsTextFrame::eInflated); + provider.InitializeForDisplay(true); + + nsIFrame*decorationsBlock; + if (IsFloatingFirstLetterChild()) { + decorationsBlock = GetParent(); + } else { + for (nsIFrame* f = this; f; f = f->GetParent()) { + nsBlockFrame* fBlock = nsLayoutUtils::GetAsBlock(f); + if (fBlock) { + decorationsBlock = fBlock; + break; + } + } + } + UnionAdditionalOverflow(PresContext(), decorationsBlock, provider, + &overflowAreas.VisualOverflow(), true); + return FinishAndStoreOverflow(overflowAreas, GetSize()); +} diff --git a/layout/generic/nsTextFrame.h b/layout/generic/nsTextFrame.h index e7a28d1d981..5b9575c1924 100644 --- a/layout/generic/nsTextFrame.h +++ b/layout/generic/nsTextFrame.h @@ -519,6 +519,8 @@ public: bool IsFloatingFirstLetterChild() const; + virtual bool UpdateOverflow() MOZ_OVERRIDE; + protected: virtual ~nsTextFrame(); @@ -552,7 +554,7 @@ protected: SelectionDetails* GetSelectionDetails(); void UnionAdditionalOverflow(nsPresContext* aPresContext, - const nsHTMLReflowState& aBlockReflowState, + nsIFrame* aBlock, PropertyProvider& aProvider, nsRect* aVisualOverflowRect, bool aIncludeTextDecorations); diff --git a/layout/reftests/text-decoration/reftest.list b/layout/reftests/text-decoration/reftest.list index 8f7e7d8a60a..cf21e509802 100644 --- a/layout/reftests/text-decoration/reftest.list +++ b/layout/reftests/text-decoration/reftest.list @@ -6,7 +6,7 @@ skip-if(B2G) == complex-decoration-style-standards.html complex-decoration-style == decoration-style-standards.html decoration-style-standards-ref.html == dynamic-underline-vertical-align-quirks-1.html dynamic-underline-vertical-align-quirks-1-ref.html == dynamic-underline-vertical-align-standards-1.html dynamic-underline-vertical-align-standards-1-ref.html -fails == dynamic-underline-vertical-align-quirks-2.html dynamic-underline-vertical-align-quirks-2-ref.html # Bug 750917 +== dynamic-underline-vertical-align-quirks-2.html dynamic-underline-vertical-align-quirks-2-ref.html == dynamic-underline-vertical-align-standards-2.html dynamic-underline-vertical-align-standards-2-ref.html == line-through-style-block-solid-quirks.html line-through-style-block-quirks-ref.html != line-through-style-block-dotted-quirks.html line-through-style-block-quirks-ref.html diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 47d0748cce2..26d18bdf436 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -2992,17 +2992,11 @@ nsChangeHint nsStyleTextReset::CalcDifference(const nsStyleTextReset& aOther) co uint8_t otherLineStyle = aOther.GetDecorationStyle(); if (mTextDecorationLine != aOther.mTextDecorationLine || lineStyle != otherLineStyle) { - // Reflow for decoration line style changes only to or from double or - // wave because that may cause overflow area changes - if (lineStyle == NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE || - lineStyle == NS_STYLE_TEXT_DECORATION_STYLE_WAVY || - otherLineStyle == NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE || - otherLineStyle == NS_STYLE_TEXT_DECORATION_STYLE_WAVY) { - return NS_STYLE_HINT_REFLOW; - } // Repaint for other style decoration lines because they must be in // default overflow rect - return NS_STYLE_HINT_VISUAL; + nsChangeHint hint = NS_STYLE_HINT_VISUAL; + NS_UpdateHint(hint, nsChangeHint_UpdateSubtreeOverflow); + return hint; } // Repaint for decoration color changes diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index f162bf7a4ca..f4c4383d9d0 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -1480,7 +1480,9 @@ struct nsStyleTextReset { nsChangeHint CalcDifference(const nsStyleTextReset& aOther) const; static nsChangeHint MaxDifference() { - return NS_STYLE_HINT_REFLOW; + return nsChangeHint( + NS_STYLE_HINT_REFLOW | + nsChangeHint_UpdateSubtreeOverflow); } static nsChangeHint MaxDifferenceNeverInherited() { // CalcDifference never returns nsChangeHint_NeedReflow or From 1f7eeb76d831ca5f13ab66ed0d5119cb127bd807 Mon Sep 17 00:00:00 2001 From: "Byron Campen [:bwc]" Date: Tue, 10 Jun 2014 10:45:01 -0700 Subject: [PATCH 18/68] Bug 1008796 - Fix return value in nr_ice_component_stun_server_default_cb. r=ekr --- media/mtransport/third_party/nICEr/src/ice/ice_component.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media/mtransport/third_party/nICEr/src/ice/ice_component.c b/media/mtransport/third_party/nICEr/src/ice/ice_component.c index f3fd9ab0832..5a50f63616d 100644 --- a/media/mtransport/third_party/nICEr/src/ice/ice_component.c +++ b/media/mtransport/third_party/nICEr/src/ice/ice_component.c @@ -889,7 +889,7 @@ static int nr_ice_component_stun_server_default_cb(void *cb_arg,nr_stun_server_c _status=0; abort: - return 0; + return(_status); } int nr_ice_component_nominated_pair(nr_ice_component *comp, nr_ice_cand_pair *pair) From 5e7352d0f522ab2146cff66832bb24c548f858e0 Mon Sep 17 00:00:00 2001 From: Randy Lin Date: Tue, 10 Jun 2014 10:32:30 +0800 Subject: [PATCH 19/68] Bug 1011149 - Video freezes when audio track is disabled on remote stream. r=jesup --- content/media/AudioSegment.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/media/AudioSegment.h b/content/media/AudioSegment.h index 7d5aedc6f07..13630b3f93a 100644 --- a/content/media/AudioSegment.h +++ b/content/media/AudioSegment.h @@ -188,7 +188,7 @@ public: AudioChunk& c = *ci; // If this chunk is null, don't bother resampling, just alter its duration if (c.IsNull()) { - c.mDuration *= aOutRate / aInRate; + c.mDuration = (c.mDuration * aOutRate) / aInRate; mDuration += c.mDuration; continue; } From e819a9c1306102f99e1bd782ae49280fffc2acd1 Mon Sep 17 00:00:00 2001 From: chiajung hung Date: Thu, 12 Jun 2014 02:06:00 -0400 Subject: [PATCH 20/68] Bug 1012961 - ABORT: Invalid SurfaceDescriptor passed in: file gfx/layers/opengl/GrallocTextureHost.cpp, line 292. r=nical --- gfx/layers/ipc/SharedBufferManagerChild.cpp | 6 +++--- gfx/layers/ipc/SharedBufferManagerParent.cpp | 13 +++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/gfx/layers/ipc/SharedBufferManagerChild.cpp b/gfx/layers/ipc/SharedBufferManagerChild.cpp index e4707736925..348505b71b3 100644 --- a/gfx/layers/ipc/SharedBufferManagerChild.cpp +++ b/gfx/layers/ipc/SharedBufferManagerChild.cpp @@ -287,7 +287,7 @@ void SharedBufferManagerChild::DeallocGrallocBuffer(const mozilla::layers::MaybeMagicGrallocBufferHandle& aBuffer) { #ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC - NS_ASSERTION(aBuffer.type() != mozilla::layers::MaybeMagicGrallocBufferHandle::TMagicGrallocBufferHandle, "We shouldn't trying to do IPC with real buffer"); + NS_ASSERTION(aBuffer.type() != mozilla::layers::MaybeMagicGrallocBufferHandle::TMagicGrallocBufferHandle, "We shouldn't try to do IPC with real buffer"); if (aBuffer.type() != mozilla::layers::MaybeMagicGrallocBufferHandle::TGrallocBufferRef) { return; } @@ -305,7 +305,7 @@ void SharedBufferManagerChild::DeallocGrallocBufferNow(const mozilla::layers::MaybeMagicGrallocBufferHandle& aBuffer) { #ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC - NS_ASSERTION(aBuffer.type() != mozilla::layers::MaybeMagicGrallocBufferHandle::TMagicGrallocBufferHandle, "We shouldn't trying to do IPC with real buffer"); + NS_ASSERTION(aBuffer.type() != mozilla::layers::MaybeMagicGrallocBufferHandle::TMagicGrallocBufferHandle, "We shouldn't try to do IPC with real buffer"); { MutexAutoLock lock(mBufferMutex); @@ -325,7 +325,7 @@ bool SharedBufferManagerChild::RecvDropGrallocBuffer(const mozilla::layers::Mayb { MutexAutoLock lock(mBufferMutex); - NS_ASSERTION(mBuffers.count(bufferKey) != 0, "Not my buffer"); + NS_ASSERTION(mBuffers.count(bufferKey) != 0, "No such buffer"); mBuffers.erase(bufferKey); } #endif diff --git a/gfx/layers/ipc/SharedBufferManagerParent.cpp b/gfx/layers/ipc/SharedBufferManagerParent.cpp index 266509437bc..0670ba2e17e 100644 --- a/gfx/layers/ipc/SharedBufferManagerParent.cpp +++ b/gfx/layers/ipc/SharedBufferManagerParent.cpp @@ -197,7 +197,7 @@ bool SharedBufferManagerParent::RecvDropGrallocBuffer(const mozilla::layers::May sp buf = GetGraphicBuffer(bufferKey); MOZ_ASSERT(buf.get()); MutexAutoLock lock(mBuffersMutex); - NS_ASSERTION(mBuffers.count(bufferKey) == 1, "How can you drop others buffer"); + NS_ASSERTION(mBuffers.count(bufferKey) == 1, "No such buffer"); mBuffers.erase(bufferKey); if(!buf.get()) { @@ -252,7 +252,7 @@ void SharedBufferManagerParent::DropGrallocBufferImpl(mozilla::layers::SurfaceDe key = handle.get_MagicGrallocBufferHandle().mRef.mKey; NS_ASSERTION(key != -1, "Invalid buffer key"); - NS_ASSERTION(mBuffers.count(key) == 1, "How can you drop others buffer"); + NS_ASSERTION(mBuffers.count(key) == 1, "No such buffer"); mBuffers.erase(key); SendDropGrallocBuffer(handle); #endif @@ -275,8 +275,13 @@ android::sp SharedBufferManagerParent::GetGraphicBuffer(int key) { MutexAutoLock lock(mBuffersMutex); - NS_ASSERTION(mBuffers.count(key) == 1, "No such buffer, or the buffer is belongs to other session"); - return mBuffers[key]; + if (mBuffers.count(key) == 1) { + return mBuffers[key]; + } + else { + // The buffer can be dropped, or invalid + return nullptr; + } } android::sp From ccff5257e20d222779260368b962e901330c3a84 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Mon, 9 Jun 2014 19:26:00 -0400 Subject: [PATCH 21/68] Bug 1023028 - Make SSE2_FLAGS apply for $GNU_CC regardless of OS. r=glandium --- configure.in | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/configure.in b/configure.in index 23d4ce3c17c..60f25ff9695 100644 --- a/configure.in +++ b/configure.in @@ -1302,6 +1302,9 @@ dnl ======================================================== dnl GNU specific defaults dnl ======================================================== if test "$GNU_CC"; then + MMX_FLAGS="-mmmx" + SSE_FLAGS="-msse" + SSE2_FLAGS="-msse2" # Per bug 719659 comment 2, some of the headers on ancient build machines # may require gnu89 inline semantics. But otherwise, we use C99. # But on OS X we just use C99 plus GNU extensions, in order to fix @@ -1915,10 +1918,6 @@ case "$target" in fi TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"' - MMX_FLAGS="-mmmx" - SSE_FLAGS="-msse" - SSE2_FLAGS="-msse2" - if test "x$lto_is_enabled" = "xyes"; then echo "Skipping -dead_strip because lto is enabled." dnl DTrace and -dead_strip don't interact well. See bug 403132. @@ -2010,10 +2009,6 @@ ia64*-hpux*) fi TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"' - MMX_FLAGS="-mmmx" - SSE_FLAGS="-msse" - SSE2_FLAGS="-msse2" - MOZ_GFX_OPTIMIZE_MOBILE=1 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions" ;; @@ -2035,10 +2030,6 @@ ia64*-hpux*) MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK" fi - MMX_FLAGS="-mmmx" - SSE_FLAGS="-msse" - SSE2_FLAGS="-msse2" - TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"' MOZ_MEMORY=1 @@ -2084,10 +2075,6 @@ ia64*-hpux*) DLL_PREFIX= IMPORT_LIB_SUFFIX=dll.a - MMX_FLAGS="-mmmx" - SSE_FLAGS="-msse" - SSE2_FLAGS="-msse2" - # We use mix of both POSIX and Win32 printf format across the tree, so format # warnings are useless on mingw. MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format) @@ -2297,9 +2284,6 @@ ia64*-hpux*) fi MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@' MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@)) -o $@' - MMX_FLAGS="-mmmx" - SSE_FLAGS="-msse" - SSE2_FLAGS="-msse2" ;; *-openbsd*) @@ -2315,9 +2299,6 @@ ia64*-hpux*) if test "$LIBRUNPATH"; then DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS" fi - MMX_FLAGS="-mmmx" - SSE_FLAGS="-msse" - SSE2_FLAGS="-msse2" ;; *-solaris*) @@ -2399,9 +2380,6 @@ ia64*-hpux*) if test "$OS_RELEASE" = "5.3"; then AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES) fi - MMX_FLAGS="-mmmx" - SSE_FLAGS="-msse" - SSE2_FLAGS="-msse2" fi if test "$OS_RELEASE" = "5.5.1"; then AC_DEFINE(NEED_USLEEP_PROTOTYPE) From eea908de56e37d5aef5ef09622f684e4122c220e Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Tue, 10 Jun 2014 17:09:02 -0400 Subject: [PATCH 22/68] Bug 1023491 - Deserialize FrameMetrics::mContentDescription correctly over IPC. r=kats --- gfx/ipc/GfxMessageUtils.h | 57 ++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/gfx/ipc/GfxMessageUtils.h b/gfx/ipc/GfxMessageUtils.h index 6b5a010049c..e19bec348ee 100644 --- a/gfx/ipc/GfxMessageUtils.h +++ b/gfx/ipc/GfxMessageUtils.h @@ -771,31 +771,38 @@ struct ParamTraits static bool Read(const Message* aMsg, void** aIter, paramType* aResult) { - return (ReadParam(aMsg, aIter, &aResult->mScrollableRect) && - ReadParam(aMsg, aIter, &aResult->mViewport) && - ReadParam(aMsg, aIter, &aResult->mScrollOffset) && - ReadParam(aMsg, aIter, &aResult->mDisplayPort) && - ReadParam(aMsg, aIter, &aResult->mDisplayPortMargins) && - ReadParam(aMsg, aIter, &aResult->mUseDisplayPortMargins) && - ReadParam(aMsg, aIter, &aResult->mCriticalDisplayPort) && - ReadParam(aMsg, aIter, &aResult->mCompositionBounds) && - ReadParam(aMsg, aIter, &aResult->mRootCompositionSize) && - ReadParam(aMsg, aIter, &aResult->mScrollId) && - ReadParam(aMsg, aIter, &aResult->mResolution) && - ReadParam(aMsg, aIter, &aResult->mCumulativeResolution) && - ReadParam(aMsg, aIter, &aResult->mZoom) && - ReadParam(aMsg, aIter, &aResult->mDevPixelsPerCSSPixel) && - ReadParam(aMsg, aIter, &aResult->mMayHaveTouchListeners) && - ReadParam(aMsg, aIter, &aResult->mMayHaveTouchCaret) && - ReadParam(aMsg, aIter, &aResult->mPresShellId) && - ReadParam(aMsg, aIter, &aResult->mIsRoot) && - ReadParam(aMsg, aIter, &aResult->mHasScrollgrab) && - ReadParam(aMsg, aIter, &aResult->mUpdateScrollOffset) && - ReadParam(aMsg, aIter, &aResult->mScrollGeneration) && - aMsg->ReadBytes(aIter, - reinterpret_cast(&aResult->mContentDescription), - sizeof(aResult->mContentDescription)) && - ReadParam(aMsg, aIter, &aResult->mTransformScale)); + const char* contentDescription; + if (!(ReadParam(aMsg, aIter, &aResult->mScrollableRect) && + ReadParam(aMsg, aIter, &aResult->mViewport) && + ReadParam(aMsg, aIter, &aResult->mScrollOffset) && + ReadParam(aMsg, aIter, &aResult->mDisplayPort) && + ReadParam(aMsg, aIter, &aResult->mDisplayPortMargins) && + ReadParam(aMsg, aIter, &aResult->mUseDisplayPortMargins) && + ReadParam(aMsg, aIter, &aResult->mCriticalDisplayPort) && + ReadParam(aMsg, aIter, &aResult->mCompositionBounds) && + ReadParam(aMsg, aIter, &aResult->mRootCompositionSize) && + ReadParam(aMsg, aIter, &aResult->mScrollId) && + ReadParam(aMsg, aIter, &aResult->mResolution) && + ReadParam(aMsg, aIter, &aResult->mCumulativeResolution) && + ReadParam(aMsg, aIter, &aResult->mZoom) && + ReadParam(aMsg, aIter, &aResult->mDevPixelsPerCSSPixel) && + ReadParam(aMsg, aIter, &aResult->mMayHaveTouchListeners) && + ReadParam(aMsg, aIter, &aResult->mMayHaveTouchCaret) && + ReadParam(aMsg, aIter, &aResult->mPresShellId) && + ReadParam(aMsg, aIter, &aResult->mIsRoot) && + ReadParam(aMsg, aIter, &aResult->mHasScrollgrab) && + ReadParam(aMsg, aIter, &aResult->mUpdateScrollOffset) && + ReadParam(aMsg, aIter, &aResult->mScrollGeneration) && + aMsg->ReadBytes(aIter, &contentDescription, + sizeof(aResult->mContentDescription)) && + ReadParam(aMsg, aIter, &aResult->mTransformScale))) { + return false; + } + // ReadBytes() doesn't actually copy the string, it only points + // a pointer to the string in its internal buffer. + strncpy(aResult->mContentDescription, contentDescription, + sizeof(aResult->mContentDescription)); + return true; } }; From ccd3c4ef47b0456a615fb6f4139f84cc10c5d1b7 Mon Sep 17 00:00:00 2001 From: Lars T Hansen Date: Wed, 11 Jun 2014 19:29:34 +0200 Subject: [PATCH 23/68] Bug 1023755 - PJS: Array.prototype.scanPar per-element thunk reads and writes result array; vulnerable to bailout-and-restart. r=nmatsakis --- js/src/builtin/Array.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/js/src/builtin/Array.js b/js/src/builtin/Array.js index 9399ab4e4cd..d020fbaa9fa 100644 --- a/js/src/builtin/Array.js +++ b/js/src/builtin/Array.js @@ -864,7 +864,12 @@ function ArrayScanPar(func, mode) { if (length === 0) ThrowError(JSMSG_EMPTY_ARRAY_REDUCE); + // We need two buffers because phase2() will read an intermediate result and + // write a final result; that is safe against bailout-and-restart only if + // the intermediate and final buffers are distinct. (Bug 1023755) + // Obviously paying for a second buffer is undesirable. var buffer = NewDenseArray(length); + var buffer2 = NewDenseArray(length); parallel: for (;;) { // see ArrayMapPar() to explain why for(;;) etc if (ShouldForceSequential()) @@ -889,11 +894,12 @@ function ArrayScanPar(func, mode) { // Complete each slice using intermediates array (see comment on phase2()). // - // We start from slice 1 instead of 0 since there is no work to be done - // for slice 0. - if (numSlices > 1) - ForkJoin(phase2, 1, numSlices, ForkJoinMode(mode), buffer); - return buffer; + // Slice 0 must be handled specially - it's just a copy - since we don't + // have an identity value for the operation. + for ( var k=0, limit=finalElement(0) ; k <= limit ; k++ ) + buffer2[k] = buffer[k]; + ForkJoin(phase2, 1, numSlices, ForkJoinMode(mode), buffer2); + return buffer2; } // Sequential fallback: @@ -986,7 +992,7 @@ function ArrayScanPar(func, mode) { var indexEnd = SLICE_END_INDEX(sliceShift, indexPos, length); var intermediate = intermediates[sliceId - 1]; for (; indexPos < indexEnd; indexPos++) - UnsafePutElements(buffer, indexPos, func(intermediate, buffer[indexPos])); + UnsafePutElements(buffer2, indexPos, func(intermediate, buffer[indexPos])); } return sliceId; } From 3d5aaa0726ed368d6c3e439f98aa3f0ea61a11e7 Mon Sep 17 00:00:00 2001 From: Walter Litwinczyk Date: Wed, 11 Jun 2014 14:31:29 -0700 Subject: [PATCH 24/68] Bug 1024066 - Fix webgl-1.0.3 conformance failure OES texture half float. r=jgilbert --- content/canvas/src/WebGLContextValidate.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/content/canvas/src/WebGLContextValidate.cpp b/content/canvas/src/WebGLContextValidate.cpp index fa246ad0c34..b041a05507b 100644 --- a/content/canvas/src/WebGLContextValidate.cpp +++ b/content/canvas/src/WebGLContextValidate.cpp @@ -1206,12 +1206,8 @@ WebGLContext::ValidateTexInputData(GLenum type, int jsArrayType, WebGLTexImageFu validInput = (jsArrayType == -1 || jsArrayType == js::ArrayBufferView::TYPE_UINT8); break; - // TODO: WebGL spec doesn't allow half floats to specified as UInt16. case LOCAL_GL_HALF_FLOAT: case LOCAL_GL_HALF_FLOAT_OES: - validInput = (jsArrayType == -1); - break; - case LOCAL_GL_UNSIGNED_SHORT: case LOCAL_GL_UNSIGNED_SHORT_4_4_4_4: case LOCAL_GL_UNSIGNED_SHORT_5_5_5_1: From ee1a2854fbf3ebc2c917e1ca7d84350ef6bdb6ac Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 12 Jun 2014 06:55:55 +0900 Subject: [PATCH 25/68] Bug 1023703 - Fix static-icu windows builds after bug 1014976, r=mshal --- build/autoconf/icu.m4 | 10 +++++----- intl/icu/Makefile.in | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build/autoconf/icu.m4 b/build/autoconf/icu.m4 index b47d0335760..762c73eb696 100644 --- a/build/autoconf/icu.m4 +++ b/build/autoconf/icu.m4 @@ -84,11 +84,11 @@ if test -n "$ENABLE_INTL_API"; then case "$OS_TARGET" in WINNT) ICU_LIB_NAMES="icuin icuuc icudt" + MOZ_ICU_DBG_SUFFIX= + if test -n "$MOZ_DEBUG" -a -z "$MOZ_NO_DEBUG_RTL"; then + MOZ_ICU_DBG_SUFFIX=d + fi if test -n "$MOZ_SHARED_ICU"; then - MOZ_ICU_DBG_SUFFIX= - if test -n "$MOZ_DEBUG" -a -z "$MOZ_NO_DEBUG_RTL"; then - MOZ_ICU_DBG_SUFFIX=d - fi MOZ_ICU_LIBS='$(foreach lib,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/target/lib/$(LIB_PREFIX)$(lib)$(MOZ_ICU_DBG_SUFFIX).$(LIB_SUFFIX))' fi ;; @@ -108,7 +108,7 @@ if test -n "$ENABLE_INTL_API"; then AC_MSG_ERROR([ECMAScript Internationalization API is not yet supported on this platform]) esac if test -z "$MOZ_SHARED_ICU"; then - MOZ_ICU_LIBS='$(call EXPAND_LIBNAME_PATH,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/target/lib)' + MOZ_ICU_LIBS='$(call EXPAND_LIBNAME_PATH,$(addsuffix $(MOZ_ICU_DBG_SUFFIX),$(ICU_LIB_NAMES)),$(DEPTH)/intl/icu/target/lib)' fi fi fi diff --git a/intl/icu/Makefile.in b/intl/icu/Makefile.in index fe92ea5f5d2..ed17efa1276 100644 --- a/intl/icu/Makefile.in +++ b/intl/icu/Makefile.in @@ -34,7 +34,7 @@ ifdef ENABLE_INTL_API else # !MOZ_SHARED_ICU ifeq ($(OS_ARCH),WINNT) ICU_LIB_RENAME = $(foreach libname,$(ICU_LIB_NAMES),\ - cp -p $(DEPTH)/intl/icu/target/lib/s$(libname)$(MOZ_ICU_DBG_SUFFIX).lib $(DEPTH)/intl/icu/target/lib/$(libname).lib;) + cp -p $(DEPTH)/intl/icu/target/lib/s$(libname)$(MOZ_ICU_DBG_SUFFIX).lib $(DEPTH)/intl/icu/target/lib/$(libname)$(MOZ_ICU_DBG_SUFFIX).lib;) endif endif # MOZ_SHARED_ICU endif # !MOZ_NATIVE_ICU From 10ee52f24485c93a20b0171d4d869a9dcefece80 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Thu, 12 Jun 2014 11:31:18 -0400 Subject: [PATCH 26/68] Bug 1024463 - Define an out of line destructor for TextTrackCue so that we can forward delcare HTMLTrackElement in TextTrackCue.h; r=bzbarsky This is required because the destructor for the nsRefPtr member requires the full definition of the type. --- content/media/TextTrackCue.cpp | 4 ++++ content/media/TextTrackCue.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/content/media/TextTrackCue.cpp b/content/media/TextTrackCue.cpp index 2111d80a7c0..e2fa2fdbb2f 100644 --- a/content/media/TextTrackCue.cpp +++ b/content/media/TextTrackCue.cpp @@ -81,6 +81,10 @@ TextTrackCue::TextTrackCue(nsPIDOMWindow* aOwnerWindow, } } +TextTrackCue::~TextTrackCue() +{ +} + /** Save a reference to our creating document so we don't have to * keep getting it from our window. */ diff --git a/content/media/TextTrackCue.h b/content/media/TextTrackCue.h index bc8972ab560..a7975b20597 100644 --- a/content/media/TextTrackCue.h +++ b/content/media/TextTrackCue.h @@ -51,6 +51,8 @@ public: const nsAString& aText, HTMLTrackElement* aTrackElement, ErrorResult& aRv); + ~TextTrackCue(); + virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; TextTrack* GetTrack() const From 1d79e596f084fe7a71abd07a0407bb3ece2f5c88 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Thu, 12 Jun 2014 11:31:36 -0400 Subject: [PATCH 27/68] Bug 1024465 - Define an out of line destructor for DataStore so that we can forward delcare DataStoreImpl in DataStore.h; r=bzbarsky This is required because the destructor for the nsRefPtr member requires the full definition of the type. --- dom/datastore/DataStore.cpp | 4 ++++ dom/datastore/DataStore.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dom/datastore/DataStore.cpp b/dom/datastore/DataStore.cpp index 9e5962a094b..9467d3e91b4 100644 --- a/dom/datastore/DataStore.cpp +++ b/dom/datastore/DataStore.cpp @@ -29,6 +29,10 @@ DataStore::DataStore(nsPIDOMWindow* aWindow) { } +DataStore::~DataStore() +{ +} + already_AddRefed DataStore::Constructor(GlobalObject& aGlobal, ErrorResult& aRv) { diff --git a/dom/datastore/DataStore.h b/dom/datastore/DataStore.h index 2326ab10ec0..990b934ff85 100644 --- a/dom/datastore/DataStore.h +++ b/dom/datastore/DataStore.h @@ -27,6 +27,7 @@ public: DOMEventTargetHelper) explicit DataStore(nsPIDOMWindow* aWindow); + ~DataStore(); // WebIDL (internal functions) @@ -89,4 +90,4 @@ private: } //namespace dom } //namespace mozilla -#endif \ No newline at end of file +#endif From e28a682e5661eef7939845cf6c8f0502011e101f Mon Sep 17 00:00:00 2001 From: William Lachance Date: Thu, 12 Jun 2014 11:28:19 -0400 Subject: [PATCH 28/68] Bug 1021943 - Add some additional features to mozlog.structured to help with informational level logging;r=jgraham --- testing/mozbase/docs/mozlog_structured.rst | 5 +++ .../mozlog/mozlog/structured/__init__.py | 1 + .../mozlog/mozlog/structured/commandline.py | 7 ++++- .../structured/formatters/machformatter.py | 3 ++ .../structured/formatters/tbplformatter.py | 3 ++ .../mozlog/mozlog/structured/structuredlog.py | 31 ++++++++++++++++++- 6 files changed, 48 insertions(+), 2 deletions(-) diff --git a/testing/mozbase/docs/mozlog_structured.rst b/testing/mozbase/docs/mozlog_structured.rst index 93435bbd3c3..b2df64158ae 100644 --- a/testing/mozbase/docs/mozlog_structured.rst +++ b/testing/mozbase/docs/mozlog_structured.rst @@ -19,6 +19,10 @@ loggers with the same name share the same internal state (the "Borg" pattern). In particular the list of handler functions is the same for all loggers with the same name. +Typically, you would only instantiate one logger object per +program. Two convenience methods are provided to set and get the +default logger in the program. + Logging is threadsafe, with access to handlers protected by a ``threading.Lock``. However it is `not` process-safe. This means that applications using multiple processes, e.g. via the @@ -192,6 +196,7 @@ StructuredLogger Objects ------------------------ .. automodule:: mozlog.structured.structuredlog + :members: set_default_logger, get_default_logger .. autoclass:: StructuredLogger :members: add_handler, remove_handler, handlers, suite_start, diff --git a/testing/mozbase/mozlog/mozlog/structured/__init__.py b/testing/mozbase/mozlog/mozlog/structured/__init__.py index e9ab64c29ba..31a779108b4 100644 --- a/testing/mozbase/mozlog/mozlog/structured/__init__.py +++ b/testing/mozbase/mozlog/mozlog/structured/__init__.py @@ -4,3 +4,4 @@ import commandline import structuredlog +from structuredlog import get_default_logger, set_default_logger diff --git a/testing/mozbase/mozlog/mozlog/structured/commandline.py b/testing/mozbase/mozlog/mozlog/structured/commandline.py index 27621128c90..72ab2c03ae7 100644 --- a/testing/mozbase/mozlog/mozlog/structured/commandline.py +++ b/testing/mozbase/mozlog/mozlog/structured/commandline.py @@ -5,7 +5,7 @@ import argparse import sys -from structuredlog import StructuredLogger +from structuredlog import StructuredLogger, set_default_logger import handlers import formatters @@ -52,6 +52,9 @@ def setup_logging(suite, args, defaults): """ Configure a structuredlogger based on command line arguments. + The created structuredlogger will also be set as the default logger, and + can be retrieved with :py:func:`get_default_logger`. + :param suite: The name of the testsuite being run :param args: A dictionary of {argument_name:value} produced from parsing the command line arguments for the application @@ -90,4 +93,6 @@ def setup_logging(suite, args, defaults): logger.add_handler(handlers.StreamHandler(stream=value, formatter=formatter_cls())) + set_default_logger(logger) + return logger diff --git a/testing/mozbase/mozlog/mozlog/structured/formatters/machformatter.py b/testing/mozbase/mozlog/mozlog/structured/formatters/machformatter.py index 3fcca69a466..84dc7b4e787 100644 --- a/testing/mozbase/mozlog/mozlog/structured/formatters/machformatter.py +++ b/testing/mozbase/mozlog/mozlog/structured/formatters/machformatter.py @@ -83,6 +83,9 @@ class BaseMachFormatter(base.BaseFormatter): data["command"]) def log(self, data): + if data.get('component'): + return " ".join([data["component"], data["level"], data["message"]]) + return "%s %s" % (data["level"], data["message"]) def _get_subtest_data(self, data): diff --git a/testing/mozbase/mozlog/mozlog/structured/formatters/tbplformatter.py b/testing/mozbase/mozlog/mozlog/structured/formatters/tbplformatter.py index 0d28d6b1b8a..f704b96c3aa 100644 --- a/testing/mozbase/mozlog/mozlog/structured/formatters/tbplformatter.py +++ b/testing/mozbase/mozlog/mozlog/structured/formatters/tbplformatter.py @@ -17,6 +17,9 @@ class TbplFormatter(BaseMachFormatter): return getattr(self, data["action"])(data) def log(self, data): + if data.get('component'): + return "%s %s\n" % (data["component"], data["message"]) + return "%s\n" % (data["message"]) def process_output(self, data): diff --git a/testing/mozbase/mozlog/mozlog/structured/structuredlog.py b/testing/mozbase/mozlog/mozlog/structured/structuredlog.py index e3552ea8935..c8448549ac5 100644 --- a/testing/mozbase/mozlog/mozlog/structured/structuredlog.py +++ b/testing/mozbase/mozlog/mozlog/structured/structuredlog.py @@ -52,8 +52,34 @@ Subfields for all messages: thread - name for the thread emitting the message pid - id of the python process in which the logger is running source - name for the source emitting the message + component - name of the subcomponent emitting the message """ +_default_logger_name = None + +def get_default_logger(component=None): + """Gets the default logger if available, optionally tagged with component + name. Will return None if not yet set + + :param component: The component name to tag log messages with + """ + global _default_logger_name + + if not _default_logger_name: + return None + + return StructuredLogger(_default_logger_name, component=component) + +def set_default_logger(default_logger): + """Sets the default logger to logger. + + It can then be retrieved with :py:func:`get_default_logger` + + :param default_logger: The logger to set to default. + """ + global _default_logger_name + + _default_logger_name = default_logger.name log_levels = dict((k.upper(), v) for v, k in enumerate(["critical", "error", "warning", "info", "debug"])) @@ -67,8 +93,9 @@ class StructuredLogger(object): :param name: The name of the logger. """ - def __init__(self, name): + def __init__(self, name, component=None): self.name = name + self.component = component def add_handler(self, handler): """Add a handler to the current logger""" @@ -101,6 +128,8 @@ class StructuredLogger(object): "thread": current_thread().name, "pid": current_process().pid, "source": self.name} + if self.component: + all_data['component'] = self.component all_data.update(data) return all_data From 7aefb73722bfd0d587018732df011404d40ea2e7 Mon Sep 17 00:00:00 2001 From: Randell Jesup Date: Thu, 12 Jun 2014 12:03:42 -0400 Subject: [PATCH 29/68] Bug 1017332: log WebRTC SDP parse errors due to no \n r=ehugg --- media/webrtc/signaling/src/sipcc/core/sdp/sdp_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/media/webrtc/signaling/src/sipcc/core/sdp/sdp_main.c b/media/webrtc/signaling/src/sipcc/core/sdp/sdp_main.c index 258331230a4..0d61ca00824 100644 --- a/media/webrtc/signaling/src/sipcc/core/sdp/sdp_main.c +++ b/media/webrtc/signaling/src/sipcc/core/sdp/sdp_main.c @@ -1008,6 +1008,7 @@ sdp_result_e sdp_parse (sdp_t *sdp_p, char **bufp, u16 len) sdp_parse_error(sdp_p->peerconnection, "%s End of line beyond end of buffer.", sdp_p->debug_str); + CSFLogError(logTag, "SDP: Invalid SDP, no \\n (len %u): %*s", len, len, *bufp); end_found = TRUE; break; } From 6d8f2c04c170fbe3c4366460d5ab4eed5556f3a5 Mon Sep 17 00:00:00 2001 From: Michal Novotny Date: Thu, 12 Jun 2014 18:04:41 +0200 Subject: [PATCH 30/68] Bug 1013638 - CacheFileIn(Out)putStream::AsyncWait() doesn't respect eventTarget argument, r=honzab --- netwerk/cache2/CacheFileInputStream.cpp | 1 + netwerk/cache2/CacheFileOutputStream.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/netwerk/cache2/CacheFileInputStream.cpp b/netwerk/cache2/CacheFileInputStream.cpp index 3ae556e9b49..42b7713fbfc 100644 --- a/netwerk/cache2/CacheFileInputStream.cpp +++ b/netwerk/cache2/CacheFileInputStream.cpp @@ -278,6 +278,7 @@ CacheFileInputStream::AsyncWait(nsIInputStreamCallback *aCallback, mCallback = aCallback; mCallbackFlags = aFlags; + mCallbackTarget = aEventTarget; if (!mCallback) { if (mWaitingForUpdate) { diff --git a/netwerk/cache2/CacheFileOutputStream.cpp b/netwerk/cache2/CacheFileOutputStream.cpp index 7bfc839b1c3..63ceb2526f6 100644 --- a/netwerk/cache2/CacheFileOutputStream.cpp +++ b/netwerk/cache2/CacheFileOutputStream.cpp @@ -213,6 +213,7 @@ CacheFileOutputStream::AsyncWait(nsIOutputStreamCallback *aCallback, mCallback = aCallback; mCallbackFlags = aFlags; + mCallbackTarget = aEventTarget; if (!mCallback) return NS_OK; From 0dae1ffa7a1ea18b7f595638118943a907b1df6e Mon Sep 17 00:00:00 2001 From: Honza Bambas Date: Thu, 12 Jun 2014 18:04:42 +0200 Subject: [PATCH 31/68] Bug 1013587 - HTTP cache v2: Start preload on input stream open for existing entries, r=michal --- netwerk/cache2/CacheFileInputStream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netwerk/cache2/CacheFileInputStream.cpp b/netwerk/cache2/CacheFileInputStream.cpp index 42b7713fbfc..fc6b133bd28 100644 --- a/netwerk/cache2/CacheFileInputStream.cpp +++ b/netwerk/cache2/CacheFileInputStream.cpp @@ -330,7 +330,7 @@ CacheFileInputStream::Seek(int32_t whence, int64_t offset) return NS_ERROR_INVALID_ARG; } mPos = newPos; - EnsureCorrectChunk(true); + EnsureCorrectChunk(false); LOG(("CacheFileInputStream::Seek() [this=%p, pos=%lld]", this, mPos)); return NS_OK; From 332ff728b8f110fd59edeb15669ca8a231a04a48 Mon Sep 17 00:00:00 2001 From: Randell Jesup Date: Thu, 12 Jun 2014 12:20:10 -0400 Subject: [PATCH 32/68] Bug 1024288: Allow aec debug data to be dumped on the fly, with max size r=pkerr --- build/gyp.mozbuild | 2 +- .../modules/audio_processing/aec/aec_core.c | 90 +++++++++++++++---- .../audio_processing/aec/aec_core_internal.h | 1 + .../audio_processing/aec/echo_cancellation.c | 76 ++++++++++++---- .../webrtc/system_wrappers/interface/trace.h | 14 +++ .../system_wrappers/source/trace_impl.cc | 8 ++ 6 files changed, 155 insertions(+), 36 deletions(-) diff --git a/build/gyp.mozbuild b/build/gyp.mozbuild index e9a6064564b..001cce6cd08 100644 --- a/build/gyp.mozbuild +++ b/build/gyp.mozbuild @@ -43,7 +43,7 @@ gyp_vars = { # (for vp8) chromium sets to 0 also 'use_temporal_layers': 0, # Creates AEC internal sample dump files in current directory - # 'aec_debug_dump': 1, + 'aec_debug_dump': 1, # codec enable/disables: 'include_g711': 1, diff --git a/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core.c b/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core.c index 7dda551f3d8..99a140cfe95 100644 --- a/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core.c +++ b/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core.c @@ -28,6 +28,9 @@ #include "webrtc/system_wrappers/interface/cpu_features_wrapper.h" #include "webrtc/typedefs.h" +extern int AECDebug(); +void OpenCoreDebugFiles(AecCore* aec, int *instance_count); + // Buffer size (samples) static const size_t kBufSizePartitions = 250; // 1 second of audio in 16 kHz. @@ -211,17 +214,9 @@ int WebRtcAec_CreateAec(AecCore** aecInst) { aec = NULL; return -1; } - { - char filename[64]; - sprintf(filename, "aec_far%d.pcm", webrtc_aec_instance_count); - aec->farFile = fopen(filename, "wb"); - sprintf(filename, "aec_near%d.pcm", webrtc_aec_instance_count); - aec->nearFile = fopen(filename, "wb"); - sprintf(filename, "aec_out%d.pcm", webrtc_aec_instance_count); - aec->outFile = fopen(filename, "wb"); - sprintf(filename, "aec_out_linear%d.pcm", webrtc_aec_instance_count); - aec->outLinearFile = fopen(filename, "wb"); - } + aec->outLinearFile = aec->outFile = aec->nearFile = aec->farFile = NULL; + aec->debugWritten = 0; + OpenCoreDebugFiles(aec, &webrtc_aec_instance_count); #endif aec->delay_estimator_farend = WebRtc_CreateDelayEstimatorFarend(PART_LEN1, kHistorySizeBlocks); @@ -256,10 +251,13 @@ int WebRtcAec_FreeAec(AecCore* aec) { WebRtc_FreeBuffer(aec->far_buf_windowed); #ifdef WEBRTC_AEC_DEBUG_DUMP WebRtc_FreeBuffer(aec->far_time_buf); - fclose(aec->farFile); - fclose(aec->nearFile); - fclose(aec->outFile); - fclose(aec->outLinearFile); + if (aec->farFile) { + // we don't let one be open and not the others + fclose(aec->farFile); + fclose(aec->nearFile); + fclose(aec->outFile); + fclose(aec->outLinearFile); + } #endif WebRtc_FreeDelayEstimator(aec->delay_estimator); WebRtc_FreeDelayEstimatorFarend(aec->delay_estimator_farend); @@ -848,8 +846,15 @@ static void ProcessBlock(AecCore* aec) { int16_t farend[PART_LEN]; int16_t* farend_ptr = NULL; WebRtc_ReadBuffer(aec->far_time_buf, (void**)&farend_ptr, farend, 1); - (void)fwrite(farend_ptr, sizeof(int16_t), PART_LEN, aec->farFile); - (void)fwrite(nearend_ptr, sizeof(int16_t), PART_LEN, aec->nearFile); + OpenCoreDebugFiles(aec, &webrtc_aec_instance_count); + if (aec->farFile) { + (void)fwrite(farend_ptr, sizeof(int16_t), PART_LEN, aec->farFile); + (void)fwrite(nearend_ptr, sizeof(int16_t), PART_LEN, aec->nearFile); + aec->debugWritten += sizeof(int16_t) * PART_LEN; + if (aec->debugWritten >= AECDebugMaxSize()) { + AECDebugEnable(0); + } + } } #endif @@ -1006,8 +1011,11 @@ static void ProcessBlock(AecCore* aec) { WEBRTC_SPL_WORD16_MAX, e[i], WEBRTC_SPL_WORD16_MIN); } - (void)fwrite(eInt16, sizeof(int16_t), PART_LEN, aec->outLinearFile); - (void)fwrite(output, sizeof(int16_t), PART_LEN, aec->outFile); + OpenCoreDebugFiles(aec, &webrtc_aec_instance_count); + if (aec->outLinearFile) { + (void)fwrite(eInt16, sizeof(int16_t), PART_LEN, aec->outLinearFile); + (void)fwrite(output, sizeof(int16_t), PART_LEN, aec->outFile); + } } #endif } @@ -1711,3 +1719,47 @@ static void TimeToFrequency(float time_data[PART_LEN2], } } +#ifdef WEBRTC_AEC_DEBUG_DUMP +void +OpenCoreDebugFiles(AecCore* aec, + int *instance_count) +{ + int error = 0; + // XXX If this impacts performance (opening files here), move file open + // to Trace::set_aec_debug(), and just grab them here + if (AECDebug() && !aec->farFile) { + char filename[128]; + if (!aec->farFile) { + sprintf(filename, "aec_far%d.pcm", webrtc_aec_instance_count); + aec->farFile = fopen(filename, "wb"); + sprintf(filename, "aec_near%d.pcm", webrtc_aec_instance_count); + aec->nearFile = fopen(filename, "wb"); + sprintf(filename, "aec_out%d.pcm", webrtc_aec_instance_count); + aec->outFile = fopen(filename, "wb"); + sprintf(filename, "aec_out_linear%d.pcm", webrtc_aec_instance_count); + aec->outLinearFile = fopen(filename, "wb"); + aec->debugWritten = 0; + if (!aec->outLinearFile || !aec->outFile || !aec->nearFile || !aec->farFile) { + error = 1; + } + } + } + if (error || + (!AECDebug() && aec->farFile)) { + if (aec->farFile) { + fclose(aec->farFile); + } + if (aec->nearFile) { + fclose(aec->nearFile); + } + if (aec->outFile) { + fclose(aec->outFile); + } + if (aec->outLinearFile) { + fclose(aec->outLinearFile); + } + aec->outLinearFile = aec->outFile = aec->nearFile = aec->farFile = NULL; + aec->debugWritten = 0; + } +} +#endif diff --git a/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core_internal.h b/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core_internal.h index 193369382ca..8655d47cd80 100644 --- a/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core_internal.h +++ b/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core_internal.h @@ -133,6 +133,7 @@ struct AecCore { FILE* nearFile; FILE* outFile; FILE* outLinearFile; + uint32_t debugWritten; #endif }; diff --git a/media/webrtc/trunk/webrtc/modules/audio_processing/aec/echo_cancellation.c b/media/webrtc/trunk/webrtc/modules/audio_processing/aec/echo_cancellation.c index bbdd5f628b2..2bc06c47ac7 100644 --- a/media/webrtc/trunk/webrtc/modules/audio_processing/aec/echo_cancellation.c +++ b/media/webrtc/trunk/webrtc/modules/audio_processing/aec/echo_cancellation.c @@ -27,6 +27,8 @@ #include "webrtc/modules/audio_processing/utility/ring_buffer.h" #include "webrtc/typedefs.h" +extern int AECDebug(); + // Measured delays [ms] // Device Chrome GTP // MacBook Air 10 @@ -165,16 +167,9 @@ int32_t WebRtcAec_Create(void** aecInst) { aecpc = NULL; return -1; } - { - char filename[64]; - sprintf(filename, "aec_buf%d.dat", webrtc_aec_instance_count); - aecpc->bufFile = fopen(filename, "wb"); - sprintf(filename, "aec_skew%d.dat", webrtc_aec_instance_count); - aecpc->skewFile = fopen(filename, "wb"); - sprintf(filename, "aec_delay%d.dat", webrtc_aec_instance_count); - aecpc->delayFile = fopen(filename, "wb"); - webrtc_aec_instance_count++; - } + aecpc->bufFile = aecpc->skewFile = aecpc->delayFile = NULL; + OpenDebugFiles(aecpc, &webrtc_aec_instance_count); + #endif return 0; @@ -191,9 +186,12 @@ int32_t WebRtcAec_Free(void* aecInst) { #ifdef WEBRTC_AEC_DEBUG_DUMP WebRtc_FreeBuffer(aecpc->far_pre_buf_s16); - fclose(aecpc->bufFile); - fclose(aecpc->skewFile); - fclose(aecpc->delayFile); + if (aecpc->bufFile) { + // we don't let one be open and not the others + fclose(aecpc->bufFile); + fclose(aecpc->skewFile); + fclose(aecpc->delayFile); + } #endif WebRtcAec_FreeAec(aecpc->aec); @@ -439,9 +437,12 @@ int32_t WebRtcAec_Process(void* aecInst, { int16_t far_buf_size_ms = (int16_t)(WebRtcAec_system_delay(aecpc->aec) / (sampMsNb * aecpc->rate_factor)); - (void)fwrite(&far_buf_size_ms, 2, 1, aecpc->bufFile); - (void)fwrite( + OpenDebugFiles(aecpc, &webrtc_aec_instance_count); + if (aecpc->bufFile) { + (void)fwrite(&far_buf_size_ms, 2, 1, aecpc->bufFile); + (void)fwrite( &aecpc->knownDelay, sizeof(aecpc->knownDelay), 1, aecpc->delayFile); + } } #endif @@ -678,7 +679,10 @@ static int ProcessNormal(aecpc_t* aecpc, } #ifdef WEBRTC_AEC_DEBUG_DUMP - (void)fwrite(&aecpc->skew, sizeof(aecpc->skew), 1, aecpc->skewFile); + OpenDebugFiles(aecpc, &webrtc_aec_instance_count); + if (aecpc->skewFile) { + (void)fwrite(&aecpc->skew, sizeof(aecpc->skew), 1, aecpc->skewFile); + } #endif } } @@ -968,3 +972,43 @@ static void EstBufDelayExtended(aecpc_t* self) { self->knownDelay = WEBRTC_SPL_MAX((int)self->filtDelay - 256, 0); } } + +#ifdef WEBRTC_AEC_DEBUG_DUMP +void +OpenDebugFiles(aecpc_t* aecpc, + int *instance_count) +{ + int error = 0; + // XXX If this impacts performance (opening files here), move file open + // to Trace::set_aec_debug(), and just grab them here + if (AECDebug() && !aecpc->bufFile) { + char filename[128]; + sprintf(filename, "aec_buf%d.dat", *instance_count); + aecpc->bufFile = fopen(filename, "wb"); + sprintf(filename, "aec_skew%d.dat", *instance_count); + aecpc->skewFile = fopen(filename, "wb"); + sprintf(filename, "aec_delay%d.dat", *instance_count); + aecpc->delayFile = fopen(filename, "wb"); + + if (!aecpc->bufFile || !aecpc->skewFile || !aecpc->delayFile) { + error = 1; + } else { + (*instance_count)++; + } + } + if (error || + (!AECDebug() && aecpc->bufFile)) { + if (aecpc->bufFile) { + fclose(aecpc->bufFile); + } + if (aecpc->skewFile) { + fclose(aecpc->skewFile); + } + if (aecpc->delayFile) { + fclose(aecpc->delayFile); + } + aecpc->bufFile = aecpc->skewFile = aecpc->delayFile = NULL; + } +} + +#endif diff --git a/media/webrtc/trunk/webrtc/system_wrappers/interface/trace.h b/media/webrtc/trunk/webrtc/system_wrappers/interface/trace.h index 44ea658bdf2..9085680b537 100644 --- a/media/webrtc/trunk/webrtc/system_wrappers/interface/trace.h +++ b/media/webrtc/trunk/webrtc/system_wrappers/interface/trace.h @@ -54,6 +54,12 @@ class Trace { // Returns what type of messages are written to the trace file. static uint32_t level_filter() { return level_filter_; } + // Enable dumping of AEC inputs and outputs. Can be changed in mid-call + static void set_aec_debug(bool enable) { aec_debug_ = enable; } + static void set_aec_debug_size(uint32_t size) { aec_debug_size_ = size; } + static bool aec_debug() { return aec_debug_; } + static uint32_t aec_debug_size() { return aec_debug_size_; } + // Sets the file name. If add_file_counter is false the same file will be // reused when it fills up. If it's true a new file with incremented name // will be used. @@ -85,8 +91,16 @@ class Trace { private: static uint32_t level_filter_; + static bool aec_debug_; + static uint32_t aec_debug_size_; }; } // namespace webrtc +extern "C" { + extern int AECDebug(); + extern uint32_t AECDebugMaxSize(); + extern void AECDebugEnable(uint32_t enable); +} + #endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_TRACE_H_ diff --git a/media/webrtc/trunk/webrtc/system_wrappers/source/trace_impl.cc b/media/webrtc/trunk/webrtc/system_wrappers/source/trace_impl.cc index 73b5b29b056..f5b05ac4f5f 100644 --- a/media/webrtc/trunk/webrtc/system_wrappers/source/trace_impl.cc +++ b/media/webrtc/trunk/webrtc/system_wrappers/source/trace_impl.cc @@ -29,12 +29,20 @@ #pragma warning(disable:4355) #endif // _WIN32 +extern "C" { + int AECDebug() { return (int) webrtc::Trace::aec_debug(); } + uint32_t AECDebugMaxSize() { return webrtc::Trace::aec_debug_size(); } + void AECDebugEnable(uint32_t enable) { webrtc::Trace::set_aec_debug(!!enable); } +} + namespace webrtc { const int Trace::kBoilerplateLength = 71; const int Trace::kTimestampPosition = 13; const int Trace::kTimestampLength = 12; uint32_t Trace::level_filter_ = kTraceDefault; +bool Trace::aec_debug_ = false; +uint32_t Trace::aec_debug_size_ = 4*1024*1024; // Construct On First Use idiom. Avoids "static initialization order fiasco". TraceImpl* TraceImpl::StaticInstance(CountOperation count_operation, From 0a434412d2f38f15095ed4acf6934226014091bc Mon Sep 17 00:00:00 2001 From: Randell Jesup Date: Thu, 12 Jun 2014 12:21:38 -0400 Subject: [PATCH 33/68] Bug 1024288: Add a button to about:webrtc to turn on/off AEC logging r=jib,smaug,unfocused --- dom/webidl/WebrtcGlobalInformation.webidl | 3 +++ .../src/common/browser_logging/WebRtcLog.cpp | 15 +++++++++++ .../WebrtcGlobalInformation.cpp | 16 ++++++++++++ .../peerconnection/WebrtcGlobalInformation.h | 3 +++ modules/libpref/src/init/all.js | 1 + toolkit/content/aboutWebrtc.xhtml | 26 +++++++++++++++++++ 6 files changed, 64 insertions(+) diff --git a/dom/webidl/WebrtcGlobalInformation.webidl b/dom/webidl/WebrtcGlobalInformation.webidl index 0715a27df5a..70e021c59d5 100644 --- a/dom/webidl/WebrtcGlobalInformation.webidl +++ b/dom/webidl/WebrtcGlobalInformation.webidl @@ -29,6 +29,9 @@ interface WebrtcGlobalInformation { // - Subsequently setting a zero debug level writes that log to disk. static attribute long debugLevel; + + // WebRTC AEC debugging enable + static attribute boolean aecDebug; }; diff --git a/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp b/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp index 75d112a5df1..d702d9ad148 100644 --- a/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp +++ b/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp @@ -28,6 +28,15 @@ static PRLogModuleInfo* GetWebRtcTraceLog() return sLog; } +static PRLogModuleInfo* GetWebRtcAECLog() +{ + static PRLogModuleInfo *sLog; + if (!sLog) { + sLog = PR_NewLogModule("AEC"); + } + return sLog; +} + class WebRtcTraceCallback: public webrtc::TraceCallback { public: @@ -48,6 +57,7 @@ void GetWebRtcLogPrefs(uint32_t *aTraceMask, nsACString* aLogFile, bool *aMultiL *aMultiLog = mozilla::Preferences::GetBool("media.webrtc.debug.multi_log"); *aTraceMask = mozilla::Preferences::GetUint("media.webrtc.debug.trace_mask"); mozilla::Preferences::GetCString("media.webrtc.debug.log_file", aLogFile); + webrtc::Trace::set_aec_debug_size(mozilla::Preferences::GetUint("media.webrtc.debug.aec_dump_max_size")); } #endif @@ -70,6 +80,11 @@ void CheckOverrides(uint32_t *aTraceMask, nsACString *aLogFile, bool *aMultiLog) *aTraceMask = log_info->level; } + log_info = GetWebRtcAECLog(); + if (log_info && (log_info->level != 0)) { + webrtc::Trace::set_aec_debug(true); + } + const char *file_name = PR_GetEnv("WEBRTC_TRACE_FILE"); if (file_name) { aLogFile->Assign(file_name); diff --git a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp index 9ca9d04b0aa..089c95b657b 100644 --- a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp +++ b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp @@ -23,6 +23,7 @@ #include "runnable_utils.h" #include "PeerConnectionCtx.h" #include "PeerConnectionImpl.h" +#include "webrtc/system_wrappers/interface/trace.h" using sipcc::PeerConnectionImpl; using sipcc::PeerConnectionCtx; @@ -233,6 +234,7 @@ WebrtcGlobalInformation::GetLogging( } static int32_t sLastSetLevel = 0; +static bool sLastAECDebug = false; void WebrtcGlobalInformation::SetDebugLevel(const GlobalObject& aGlobal, int32_t aLevel) @@ -247,6 +249,20 @@ WebrtcGlobalInformation::DebugLevel(const GlobalObject& aGlobal) return sLastSetLevel; } +void +WebrtcGlobalInformation::SetAecDebug(const GlobalObject& aGlobal, bool aEnable) +{ + webrtc::Trace::set_aec_debug(aEnable); + sLastAECDebug = aEnable; +} + +bool +WebrtcGlobalInformation::AecDebug(const GlobalObject& aGlobal) +{ + return sLastAECDebug; +} + + struct StreamResult { StreamResult() : candidateTypeBitpattern(0), streamSucceeded(false) {} uint8_t candidateTypeBitpattern; diff --git a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.h b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.h index 906bac1f908..5e31c489683 100644 --- a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.h +++ b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.h @@ -36,6 +36,9 @@ public: static void SetDebugLevel(const GlobalObject& aGlobal, int32_t aLevel); static int32_t DebugLevel(const GlobalObject& aGlobal); + static void SetAecDebug(const GlobalObject& aGlobal, bool aEnable); + static bool AecDebug(const GlobalObject& aGlobal); + static void StoreLongTermICEStatistics(sipcc::PeerConnectionImpl& aPc); private: diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index 04c1a9e8542..15a45ab2ae1 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -265,6 +265,7 @@ pref("media.webrtc.debug.log_file", ""); #else pref("media.webrtc.debug.log_file", "/tmp/WebRTC.log"); #endif +pref("media.webrtc.debug.aec_dump_max_size", 4194304); // 4MB #ifdef MOZ_WIDGET_GONK pref("media.navigator.video.default_width",320); diff --git a/toolkit/content/aboutWebrtc.xhtml b/toolkit/content/aboutWebrtc.xhtml index ff23f6e1cd5..e60f75ef9fa 100644 --- a/toolkit/content/aboutWebrtc.xhtml +++ b/toolkit/content/aboutWebrtc.xhtml @@ -377,6 +377,11 @@ function onLoad() { } else { setDebugButton(false); } + if (WebrtcGlobalInformation.aecDebug) { + setAECDebugButton(true); + } else { + setAECDebugButton(false); + } } function startDebugMode() { @@ -395,6 +400,24 @@ function setDebugButton(on) { button.onclick = on ? stopDebugMode : startDebugMode; } +function startAECDebugMode() { + WebrtcGlobalInformation.aecDebug = true; + setAECDebugButton(true); +} + +function stopAECDebugMode() { + WebrtcGlobalInformation.aecDebug = false; + setAECDebugButton(false); +} + +function setAECDebugButton(on) { + var button = document.getElementById("aec-debug-toggle-button"); + button.innerHTML = on ? "Stop AEC logging" : "Start AEC logging"; + button.onclick = on ? stopAECDebugMode : startAECDebugMode; +} + + + @@ -406,6 +429,9 @@ function setDebugButton(on) { +
    From fd0c5f398d7adca85e2e649dacb6d266418c146e Mon Sep 17 00:00:00 2001 From: Jonathan Griffin Date: Thu, 12 Jun 2014 09:23:12 -0700 Subject: [PATCH 34/68] Bug 994920 - Add --test-path to in-tree B2G mochitest config, r=ahal --- testing/config/mozharness/b2g_emulator_config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/testing/config/mozharness/b2g_emulator_config.py b/testing/config/mozharness/b2g_emulator_config.py index 42b7cd875e3..da4882e036d 100644 --- a/testing/config/mozharness/b2g_emulator_config.py +++ b/testing/config/mozharness/b2g_emulator_config.py @@ -20,6 +20,7 @@ config = { "--xre-path=%(xre_path)s", "--symbols-path=%(symbols_path)s", "--busybox=%(busybox)s", "--total-chunks=%(total_chunks)s", "--this-chunk=%(this_chunk)s", "--quiet", "--certificate-path=%(certificate_path)s", + "--test-path=%(test_path)s", ], "reftest_options": [ From 03812e8f9a43586b5d4a0913843d146a46a899f2 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Thu, 12 Jun 2014 17:40:44 +0100 Subject: [PATCH 35/68] Backed out changeset 5d63a1316981 (bug 1024288) --- dom/webidl/WebrtcGlobalInformation.webidl | 3 --- .../src/common/browser_logging/WebRtcLog.cpp | 15 ----------- .../WebrtcGlobalInformation.cpp | 16 ------------ .../peerconnection/WebrtcGlobalInformation.h | 3 --- modules/libpref/src/init/all.js | 1 - toolkit/content/aboutWebrtc.xhtml | 26 ------------------- 6 files changed, 64 deletions(-) diff --git a/dom/webidl/WebrtcGlobalInformation.webidl b/dom/webidl/WebrtcGlobalInformation.webidl index 70e021c59d5..0715a27df5a 100644 --- a/dom/webidl/WebrtcGlobalInformation.webidl +++ b/dom/webidl/WebrtcGlobalInformation.webidl @@ -29,9 +29,6 @@ interface WebrtcGlobalInformation { // - Subsequently setting a zero debug level writes that log to disk. static attribute long debugLevel; - - // WebRTC AEC debugging enable - static attribute boolean aecDebug; }; diff --git a/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp b/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp index d702d9ad148..75d112a5df1 100644 --- a/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp +++ b/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp @@ -28,15 +28,6 @@ static PRLogModuleInfo* GetWebRtcTraceLog() return sLog; } -static PRLogModuleInfo* GetWebRtcAECLog() -{ - static PRLogModuleInfo *sLog; - if (!sLog) { - sLog = PR_NewLogModule("AEC"); - } - return sLog; -} - class WebRtcTraceCallback: public webrtc::TraceCallback { public: @@ -57,7 +48,6 @@ void GetWebRtcLogPrefs(uint32_t *aTraceMask, nsACString* aLogFile, bool *aMultiL *aMultiLog = mozilla::Preferences::GetBool("media.webrtc.debug.multi_log"); *aTraceMask = mozilla::Preferences::GetUint("media.webrtc.debug.trace_mask"); mozilla::Preferences::GetCString("media.webrtc.debug.log_file", aLogFile); - webrtc::Trace::set_aec_debug_size(mozilla::Preferences::GetUint("media.webrtc.debug.aec_dump_max_size")); } #endif @@ -80,11 +70,6 @@ void CheckOverrides(uint32_t *aTraceMask, nsACString *aLogFile, bool *aMultiLog) *aTraceMask = log_info->level; } - log_info = GetWebRtcAECLog(); - if (log_info && (log_info->level != 0)) { - webrtc::Trace::set_aec_debug(true); - } - const char *file_name = PR_GetEnv("WEBRTC_TRACE_FILE"); if (file_name) { aLogFile->Assign(file_name); diff --git a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp index 089c95b657b..9ca9d04b0aa 100644 --- a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp +++ b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp @@ -23,7 +23,6 @@ #include "runnable_utils.h" #include "PeerConnectionCtx.h" #include "PeerConnectionImpl.h" -#include "webrtc/system_wrappers/interface/trace.h" using sipcc::PeerConnectionImpl; using sipcc::PeerConnectionCtx; @@ -234,7 +233,6 @@ WebrtcGlobalInformation::GetLogging( } static int32_t sLastSetLevel = 0; -static bool sLastAECDebug = false; void WebrtcGlobalInformation::SetDebugLevel(const GlobalObject& aGlobal, int32_t aLevel) @@ -249,20 +247,6 @@ WebrtcGlobalInformation::DebugLevel(const GlobalObject& aGlobal) return sLastSetLevel; } -void -WebrtcGlobalInformation::SetAecDebug(const GlobalObject& aGlobal, bool aEnable) -{ - webrtc::Trace::set_aec_debug(aEnable); - sLastAECDebug = aEnable; -} - -bool -WebrtcGlobalInformation::AecDebug(const GlobalObject& aGlobal) -{ - return sLastAECDebug; -} - - struct StreamResult { StreamResult() : candidateTypeBitpattern(0), streamSucceeded(false) {} uint8_t candidateTypeBitpattern; diff --git a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.h b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.h index 5e31c489683..906bac1f908 100644 --- a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.h +++ b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.h @@ -36,9 +36,6 @@ public: static void SetDebugLevel(const GlobalObject& aGlobal, int32_t aLevel); static int32_t DebugLevel(const GlobalObject& aGlobal); - static void SetAecDebug(const GlobalObject& aGlobal, bool aEnable); - static bool AecDebug(const GlobalObject& aGlobal); - static void StoreLongTermICEStatistics(sipcc::PeerConnectionImpl& aPc); private: diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index 15a45ab2ae1..04c1a9e8542 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -265,7 +265,6 @@ pref("media.webrtc.debug.log_file", ""); #else pref("media.webrtc.debug.log_file", "/tmp/WebRTC.log"); #endif -pref("media.webrtc.debug.aec_dump_max_size", 4194304); // 4MB #ifdef MOZ_WIDGET_GONK pref("media.navigator.video.default_width",320); diff --git a/toolkit/content/aboutWebrtc.xhtml b/toolkit/content/aboutWebrtc.xhtml index e60f75ef9fa..ff23f6e1cd5 100644 --- a/toolkit/content/aboutWebrtc.xhtml +++ b/toolkit/content/aboutWebrtc.xhtml @@ -377,11 +377,6 @@ function onLoad() { } else { setDebugButton(false); } - if (WebrtcGlobalInformation.aecDebug) { - setAECDebugButton(true); - } else { - setAECDebugButton(false); - } } function startDebugMode() { @@ -400,24 +395,6 @@ function setDebugButton(on) { button.onclick = on ? stopDebugMode : startDebugMode; } -function startAECDebugMode() { - WebrtcGlobalInformation.aecDebug = true; - setAECDebugButton(true); -} - -function stopAECDebugMode() { - WebrtcGlobalInformation.aecDebug = false; - setAECDebugButton(false); -} - -function setAECDebugButton(on) { - var button = document.getElementById("aec-debug-toggle-button"); - button.innerHTML = on ? "Stop AEC logging" : "Start AEC logging"; - button.onclick = on ? stopAECDebugMode : startAECDebugMode; -} - - - @@ -429,9 +406,6 @@ function setAECDebugButton(on) { -
    From a5c42af94355065fa3356778573ec25d0266b896 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Thu, 12 Jun 2014 17:41:12 +0100 Subject: [PATCH 36/68] Backed out changeset 7b4feb3d3a39 (bug 1024288) for compilation errors; CLOSED TREE --- build/gyp.mozbuild | 2 +- .../modules/audio_processing/aec/aec_core.c | 90 ++++--------------- .../audio_processing/aec/aec_core_internal.h | 1 - .../audio_processing/aec/echo_cancellation.c | 76 ++++------------ .../webrtc/system_wrappers/interface/trace.h | 14 --- .../system_wrappers/source/trace_impl.cc | 8 -- 6 files changed, 36 insertions(+), 155 deletions(-) diff --git a/build/gyp.mozbuild b/build/gyp.mozbuild index 001cce6cd08..e9a6064564b 100644 --- a/build/gyp.mozbuild +++ b/build/gyp.mozbuild @@ -43,7 +43,7 @@ gyp_vars = { # (for vp8) chromium sets to 0 also 'use_temporal_layers': 0, # Creates AEC internal sample dump files in current directory - 'aec_debug_dump': 1, + # 'aec_debug_dump': 1, # codec enable/disables: 'include_g711': 1, diff --git a/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core.c b/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core.c index 99a140cfe95..7dda551f3d8 100644 --- a/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core.c +++ b/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core.c @@ -28,9 +28,6 @@ #include "webrtc/system_wrappers/interface/cpu_features_wrapper.h" #include "webrtc/typedefs.h" -extern int AECDebug(); -void OpenCoreDebugFiles(AecCore* aec, int *instance_count); - // Buffer size (samples) static const size_t kBufSizePartitions = 250; // 1 second of audio in 16 kHz. @@ -214,9 +211,17 @@ int WebRtcAec_CreateAec(AecCore** aecInst) { aec = NULL; return -1; } - aec->outLinearFile = aec->outFile = aec->nearFile = aec->farFile = NULL; - aec->debugWritten = 0; - OpenCoreDebugFiles(aec, &webrtc_aec_instance_count); + { + char filename[64]; + sprintf(filename, "aec_far%d.pcm", webrtc_aec_instance_count); + aec->farFile = fopen(filename, "wb"); + sprintf(filename, "aec_near%d.pcm", webrtc_aec_instance_count); + aec->nearFile = fopen(filename, "wb"); + sprintf(filename, "aec_out%d.pcm", webrtc_aec_instance_count); + aec->outFile = fopen(filename, "wb"); + sprintf(filename, "aec_out_linear%d.pcm", webrtc_aec_instance_count); + aec->outLinearFile = fopen(filename, "wb"); + } #endif aec->delay_estimator_farend = WebRtc_CreateDelayEstimatorFarend(PART_LEN1, kHistorySizeBlocks); @@ -251,13 +256,10 @@ int WebRtcAec_FreeAec(AecCore* aec) { WebRtc_FreeBuffer(aec->far_buf_windowed); #ifdef WEBRTC_AEC_DEBUG_DUMP WebRtc_FreeBuffer(aec->far_time_buf); - if (aec->farFile) { - // we don't let one be open and not the others - fclose(aec->farFile); - fclose(aec->nearFile); - fclose(aec->outFile); - fclose(aec->outLinearFile); - } + fclose(aec->farFile); + fclose(aec->nearFile); + fclose(aec->outFile); + fclose(aec->outLinearFile); #endif WebRtc_FreeDelayEstimator(aec->delay_estimator); WebRtc_FreeDelayEstimatorFarend(aec->delay_estimator_farend); @@ -846,15 +848,8 @@ static void ProcessBlock(AecCore* aec) { int16_t farend[PART_LEN]; int16_t* farend_ptr = NULL; WebRtc_ReadBuffer(aec->far_time_buf, (void**)&farend_ptr, farend, 1); - OpenCoreDebugFiles(aec, &webrtc_aec_instance_count); - if (aec->farFile) { - (void)fwrite(farend_ptr, sizeof(int16_t), PART_LEN, aec->farFile); - (void)fwrite(nearend_ptr, sizeof(int16_t), PART_LEN, aec->nearFile); - aec->debugWritten += sizeof(int16_t) * PART_LEN; - if (aec->debugWritten >= AECDebugMaxSize()) { - AECDebugEnable(0); - } - } + (void)fwrite(farend_ptr, sizeof(int16_t), PART_LEN, aec->farFile); + (void)fwrite(nearend_ptr, sizeof(int16_t), PART_LEN, aec->nearFile); } #endif @@ -1011,11 +1006,8 @@ static void ProcessBlock(AecCore* aec) { WEBRTC_SPL_WORD16_MAX, e[i], WEBRTC_SPL_WORD16_MIN); } - OpenCoreDebugFiles(aec, &webrtc_aec_instance_count); - if (aec->outLinearFile) { - (void)fwrite(eInt16, sizeof(int16_t), PART_LEN, aec->outLinearFile); - (void)fwrite(output, sizeof(int16_t), PART_LEN, aec->outFile); - } + (void)fwrite(eInt16, sizeof(int16_t), PART_LEN, aec->outLinearFile); + (void)fwrite(output, sizeof(int16_t), PART_LEN, aec->outFile); } #endif } @@ -1719,47 +1711,3 @@ static void TimeToFrequency(float time_data[PART_LEN2], } } -#ifdef WEBRTC_AEC_DEBUG_DUMP -void -OpenCoreDebugFiles(AecCore* aec, - int *instance_count) -{ - int error = 0; - // XXX If this impacts performance (opening files here), move file open - // to Trace::set_aec_debug(), and just grab them here - if (AECDebug() && !aec->farFile) { - char filename[128]; - if (!aec->farFile) { - sprintf(filename, "aec_far%d.pcm", webrtc_aec_instance_count); - aec->farFile = fopen(filename, "wb"); - sprintf(filename, "aec_near%d.pcm", webrtc_aec_instance_count); - aec->nearFile = fopen(filename, "wb"); - sprintf(filename, "aec_out%d.pcm", webrtc_aec_instance_count); - aec->outFile = fopen(filename, "wb"); - sprintf(filename, "aec_out_linear%d.pcm", webrtc_aec_instance_count); - aec->outLinearFile = fopen(filename, "wb"); - aec->debugWritten = 0; - if (!aec->outLinearFile || !aec->outFile || !aec->nearFile || !aec->farFile) { - error = 1; - } - } - } - if (error || - (!AECDebug() && aec->farFile)) { - if (aec->farFile) { - fclose(aec->farFile); - } - if (aec->nearFile) { - fclose(aec->nearFile); - } - if (aec->outFile) { - fclose(aec->outFile); - } - if (aec->outLinearFile) { - fclose(aec->outLinearFile); - } - aec->outLinearFile = aec->outFile = aec->nearFile = aec->farFile = NULL; - aec->debugWritten = 0; - } -} -#endif diff --git a/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core_internal.h b/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core_internal.h index 8655d47cd80..193369382ca 100644 --- a/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core_internal.h +++ b/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core_internal.h @@ -133,7 +133,6 @@ struct AecCore { FILE* nearFile; FILE* outFile; FILE* outLinearFile; - uint32_t debugWritten; #endif }; diff --git a/media/webrtc/trunk/webrtc/modules/audio_processing/aec/echo_cancellation.c b/media/webrtc/trunk/webrtc/modules/audio_processing/aec/echo_cancellation.c index 2bc06c47ac7..bbdd5f628b2 100644 --- a/media/webrtc/trunk/webrtc/modules/audio_processing/aec/echo_cancellation.c +++ b/media/webrtc/trunk/webrtc/modules/audio_processing/aec/echo_cancellation.c @@ -27,8 +27,6 @@ #include "webrtc/modules/audio_processing/utility/ring_buffer.h" #include "webrtc/typedefs.h" -extern int AECDebug(); - // Measured delays [ms] // Device Chrome GTP // MacBook Air 10 @@ -167,9 +165,16 @@ int32_t WebRtcAec_Create(void** aecInst) { aecpc = NULL; return -1; } - aecpc->bufFile = aecpc->skewFile = aecpc->delayFile = NULL; - OpenDebugFiles(aecpc, &webrtc_aec_instance_count); - + { + char filename[64]; + sprintf(filename, "aec_buf%d.dat", webrtc_aec_instance_count); + aecpc->bufFile = fopen(filename, "wb"); + sprintf(filename, "aec_skew%d.dat", webrtc_aec_instance_count); + aecpc->skewFile = fopen(filename, "wb"); + sprintf(filename, "aec_delay%d.dat", webrtc_aec_instance_count); + aecpc->delayFile = fopen(filename, "wb"); + webrtc_aec_instance_count++; + } #endif return 0; @@ -186,12 +191,9 @@ int32_t WebRtcAec_Free(void* aecInst) { #ifdef WEBRTC_AEC_DEBUG_DUMP WebRtc_FreeBuffer(aecpc->far_pre_buf_s16); - if (aecpc->bufFile) { - // we don't let one be open and not the others - fclose(aecpc->bufFile); - fclose(aecpc->skewFile); - fclose(aecpc->delayFile); - } + fclose(aecpc->bufFile); + fclose(aecpc->skewFile); + fclose(aecpc->delayFile); #endif WebRtcAec_FreeAec(aecpc->aec); @@ -437,12 +439,9 @@ int32_t WebRtcAec_Process(void* aecInst, { int16_t far_buf_size_ms = (int16_t)(WebRtcAec_system_delay(aecpc->aec) / (sampMsNb * aecpc->rate_factor)); - OpenDebugFiles(aecpc, &webrtc_aec_instance_count); - if (aecpc->bufFile) { - (void)fwrite(&far_buf_size_ms, 2, 1, aecpc->bufFile); - (void)fwrite( + (void)fwrite(&far_buf_size_ms, 2, 1, aecpc->bufFile); + (void)fwrite( &aecpc->knownDelay, sizeof(aecpc->knownDelay), 1, aecpc->delayFile); - } } #endif @@ -679,10 +678,7 @@ static int ProcessNormal(aecpc_t* aecpc, } #ifdef WEBRTC_AEC_DEBUG_DUMP - OpenDebugFiles(aecpc, &webrtc_aec_instance_count); - if (aecpc->skewFile) { - (void)fwrite(&aecpc->skew, sizeof(aecpc->skew), 1, aecpc->skewFile); - } + (void)fwrite(&aecpc->skew, sizeof(aecpc->skew), 1, aecpc->skewFile); #endif } } @@ -972,43 +968,3 @@ static void EstBufDelayExtended(aecpc_t* self) { self->knownDelay = WEBRTC_SPL_MAX((int)self->filtDelay - 256, 0); } } - -#ifdef WEBRTC_AEC_DEBUG_DUMP -void -OpenDebugFiles(aecpc_t* aecpc, - int *instance_count) -{ - int error = 0; - // XXX If this impacts performance (opening files here), move file open - // to Trace::set_aec_debug(), and just grab them here - if (AECDebug() && !aecpc->bufFile) { - char filename[128]; - sprintf(filename, "aec_buf%d.dat", *instance_count); - aecpc->bufFile = fopen(filename, "wb"); - sprintf(filename, "aec_skew%d.dat", *instance_count); - aecpc->skewFile = fopen(filename, "wb"); - sprintf(filename, "aec_delay%d.dat", *instance_count); - aecpc->delayFile = fopen(filename, "wb"); - - if (!aecpc->bufFile || !aecpc->skewFile || !aecpc->delayFile) { - error = 1; - } else { - (*instance_count)++; - } - } - if (error || - (!AECDebug() && aecpc->bufFile)) { - if (aecpc->bufFile) { - fclose(aecpc->bufFile); - } - if (aecpc->skewFile) { - fclose(aecpc->skewFile); - } - if (aecpc->delayFile) { - fclose(aecpc->delayFile); - } - aecpc->bufFile = aecpc->skewFile = aecpc->delayFile = NULL; - } -} - -#endif diff --git a/media/webrtc/trunk/webrtc/system_wrappers/interface/trace.h b/media/webrtc/trunk/webrtc/system_wrappers/interface/trace.h index 9085680b537..44ea658bdf2 100644 --- a/media/webrtc/trunk/webrtc/system_wrappers/interface/trace.h +++ b/media/webrtc/trunk/webrtc/system_wrappers/interface/trace.h @@ -54,12 +54,6 @@ class Trace { // Returns what type of messages are written to the trace file. static uint32_t level_filter() { return level_filter_; } - // Enable dumping of AEC inputs and outputs. Can be changed in mid-call - static void set_aec_debug(bool enable) { aec_debug_ = enable; } - static void set_aec_debug_size(uint32_t size) { aec_debug_size_ = size; } - static bool aec_debug() { return aec_debug_; } - static uint32_t aec_debug_size() { return aec_debug_size_; } - // Sets the file name. If add_file_counter is false the same file will be // reused when it fills up. If it's true a new file with incremented name // will be used. @@ -91,16 +85,8 @@ class Trace { private: static uint32_t level_filter_; - static bool aec_debug_; - static uint32_t aec_debug_size_; }; } // namespace webrtc -extern "C" { - extern int AECDebug(); - extern uint32_t AECDebugMaxSize(); - extern void AECDebugEnable(uint32_t enable); -} - #endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_TRACE_H_ diff --git a/media/webrtc/trunk/webrtc/system_wrappers/source/trace_impl.cc b/media/webrtc/trunk/webrtc/system_wrappers/source/trace_impl.cc index f5b05ac4f5f..73b5b29b056 100644 --- a/media/webrtc/trunk/webrtc/system_wrappers/source/trace_impl.cc +++ b/media/webrtc/trunk/webrtc/system_wrappers/source/trace_impl.cc @@ -29,20 +29,12 @@ #pragma warning(disable:4355) #endif // _WIN32 -extern "C" { - int AECDebug() { return (int) webrtc::Trace::aec_debug(); } - uint32_t AECDebugMaxSize() { return webrtc::Trace::aec_debug_size(); } - void AECDebugEnable(uint32_t enable) { webrtc::Trace::set_aec_debug(!!enable); } -} - namespace webrtc { const int Trace::kBoilerplateLength = 71; const int Trace::kTimestampPosition = 13; const int Trace::kTimestampLength = 12; uint32_t Trace::level_filter_ = kTraceDefault; -bool Trace::aec_debug_ = false; -uint32_t Trace::aec_debug_size_ = 4*1024*1024; // Construct On First Use idiom. Avoids "static initialization order fiasco". TraceImpl* TraceImpl::StaticInstance(CountOperation count_operation, From b6ae2b2e431c1cf3e4747d45e2dee5f61135d72f Mon Sep 17 00:00:00 2001 From: Inanc Seylan Date: Thu, 12 Jun 2014 09:53:09 -0700 Subject: [PATCH 37/68] Bug 1008110 - Implement BitAnd Recover instruction; r=nbp --- .../tests/ion/dce-with-rinstructions.js | 21 +++++++++++++++ js/src/jit/MIR.h | 5 ++++ js/src/jit/Recover.cpp | 27 +++++++++++++++++++ js/src/jit/Recover.h | 13 +++++++++ 4 files changed, 66 insertions(+) diff --git a/js/src/jit-test/tests/ion/dce-with-rinstructions.js b/js/src/jit-test/tests/ion/dce-with-rinstructions.js index 08dc99ada40..7b8d0db7d40 100644 --- a/js/src/jit-test/tests/ion/dce-with-rinstructions.js +++ b/js/src/jit-test/tests/ion/dce-with-rinstructions.js @@ -31,6 +31,25 @@ function rbitnot_object(i) { return i; } +var uceFault_bitand_number = eval(uneval(uceFault).replace('uceFault', 'uceFault_bitand_number')); +function rbitand_number(i) { + var x = 1 & i; + if (uceFault_bitand_number(i) || uceFault_bitand_number(i)) + assertEq(x, 1 /* = 1 & 99 */); + return i; +} + +var uceFault_bitand_object = eval(uneval(uceFault).replace('uceFault', 'uceFault_bitand_object')); +function rbitand_object(i) { + var t = i; + var o = { valueOf: function () { return t; } }; + var x = o & i; /* computed with t == i, not 1000 */ + t = 1000; + if (uceFault_bitand_object(i) || uceFault_bitand_object(i)) + assertEq(x, 99); + return i; +} + var uceFault_bitor_number = eval(uneval(uceFault).replace('uceFault', 'uceFault_bitor_number')); function rbitor_number(i) { var x = i | -100; /* -100 == ~99 */ @@ -280,6 +299,8 @@ function rconcat_number(i) { for (i = 0; i < 100; i++) { rbitnot_number(i); rbitnot_object(i); + rbitand_number(i); + rbitand_object(i); rbitor_number(i); rbitor_object(i); rbitxor_number(i); diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index 40b80d37a28..e12286ec466 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -3617,6 +3617,11 @@ class MBitAnd : public MBinaryBitwiseInstruction return getOperand(0); // x & x => x; } void computeRange(TempAllocator &alloc); + + bool writeRecoverData(CompactBufferWriter &writer) const; + bool canRecoverOnBailout() const { + return specialization_ != MIRType_None; + } }; class MBitOr : public MBinaryBitwiseInstruction diff --git a/js/src/jit/Recover.cpp b/js/src/jit/Recover.cpp index a78b2b39cb4..d9a9eb28caa 100644 --- a/js/src/jit/Recover.cpp +++ b/js/src/jit/Recover.cpp @@ -163,6 +163,33 @@ RBitNot::recover(JSContext *cx, SnapshotIterator &iter) const return true; } +bool +MBitAnd::writeRecoverData(CompactBufferWriter &writer) const +{ + MOZ_ASSERT(canRecoverOnBailout()); + writer.writeUnsigned(uint32_t(RInstruction::Recover_BitAnd)); + return true; +} + +RBitAnd::RBitAnd(CompactBufferReader &reader) +{ } + +bool +RBitAnd::recover(JSContext *cx, SnapshotIterator &iter) const +{ + RootedValue lhs(cx, iter.read()); + RootedValue rhs(cx, iter.read()); + int32_t result; + MOZ_ASSERT(!lhs.isObject() && !rhs.isObject()); + + if (!js::BitAnd(cx, lhs, rhs, &result)) + return false; + + RootedValue rootedResult(cx, js::Int32Value(result)); + iter.storeInstructionResult(rootedResult); + return true; +} + bool MBitOr::writeRecoverData(CompactBufferWriter &writer) const { diff --git a/js/src/jit/Recover.h b/js/src/jit/Recover.h index 645027057c2..9e08df39fdb 100644 --- a/js/src/jit/Recover.h +++ b/js/src/jit/Recover.h @@ -19,6 +19,7 @@ namespace jit { #define RECOVER_OPCODE_LIST(_) \ _(ResumePoint) \ _(BitNot) \ + _(BitAnd) \ _(BitOr) \ _(BitXor) \ _(Lsh) \ @@ -111,6 +112,18 @@ class RBitNot MOZ_FINAL : public RInstruction bool recover(JSContext *cx, SnapshotIterator &iter) const; }; +class RBitAnd MOZ_FINAL : public RInstruction +{ + public: + RINSTRUCTION_HEADER_(BitAnd) + + virtual uint32_t numOperands() const { + return 2; + } + + bool recover(JSContext *cx, SnapshotIterator &iter) const; +}; + class RBitOr MOZ_FINAL : public RInstruction { public: From 910eb8b47de0a7dee13dc7071f7f6a35ec92b88c Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Thu, 12 Jun 2014 10:02:33 -0700 Subject: [PATCH 38/68] Bug 990090 - Add a version of AutoJSAPIWithErrorsReportedToWindow that takes an nsIGlobalObject. r=bz --- dom/base/ScriptSettings.cpp | 5 +++++ dom/base/ScriptSettings.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/dom/base/ScriptSettings.cpp b/dom/base/ScriptSettings.cpp index e3156ebef90..b47886195ab 100644 --- a/dom/base/ScriptSettings.cpp +++ b/dom/base/ScriptSettings.cpp @@ -237,6 +237,11 @@ AutoJSAPIWithErrorsReportedToWindow::AutoJSAPIWithErrorsReportedToWindow(nsIScri { } +AutoJSAPIWithErrorsReportedToWindow::AutoJSAPIWithErrorsReportedToWindow(nsIGlobalObject* aGlobalObject) + : AutoJSAPI(FindJSContext(aGlobalObject), /* aIsMainThread = */ true) +{ +} + AutoEntryScript::AutoEntryScript(nsIGlobalObject* aGlobalObject, bool aIsMainThread, JSContext* aCx) diff --git a/dom/base/ScriptSettings.h b/dom/base/ScriptSettings.h index 0bbbe40ac5f..7097bf01068 100644 --- a/dom/base/ScriptSettings.h +++ b/dom/base/ScriptSettings.h @@ -158,6 +158,8 @@ private: class AutoJSAPIWithErrorsReportedToWindow : public AutoJSAPI { public: AutoJSAPIWithErrorsReportedToWindow(nsIScriptContext* aScx); + // Equivalent to AutoJSAPI if aGlobal is not a Window. + AutoJSAPIWithErrorsReportedToWindow(nsIGlobalObject* aGlobalObject); }; /* From 0e6ae186a735a458bccf4e0e22dac8cf7535863d Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Thu, 12 Jun 2014 10:02:33 -0700 Subject: [PATCH 39/68] Bug 990090 - Use AutoJSAPI for BroadcastErrorToSharedWorkers. r=khuey --- dom/workers/WorkerPrivate.cpp | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index fce7becd21f..cc17effe5c2 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -3127,26 +3127,10 @@ WorkerPrivateParent::BroadcastErrorToSharedWorkers( size_t actionsIndex = windowActions.LastIndexOf(WindowAction(window)); - // Get the context for this window so that we can report errors correctly. - JSContext* cx; - rv = NS_OK; - - if (actionsIndex == windowActions.NoIndex) { - nsIScriptContext* scx = sharedWorker->GetContextForEventHandlers(&rv); - cx = (NS_SUCCEEDED(rv) && scx) ? - scx->GetNativeContext() : - nsContentUtils::GetSafeJSContext(); - } else { - cx = windowActions[actionsIndex].mJSContext; - } - - AutoCxPusher autoPush(cx); - - if (NS_FAILED(rv)) { - Throw(cx, rv); - JS_ReportPendingException(cx); - continue; - } + nsIGlobalObject* global = sharedWorker->GetParentObject(); + AutoJSAPIWithErrorsReportedToWindow jsapi(global); + JSContext* cx = jsapi.cx(); + JSAutoCompartment ac(cx, global->GetGlobalJSObject()); RootedDictionary errorInit(aCx); errorInit.mBubbles = false; @@ -3168,7 +3152,7 @@ WorkerPrivateParent::BroadcastErrorToSharedWorkers( errorEvent->SetTrusted(true); bool defaultActionEnabled; - rv = sharedWorker->DispatchEvent(errorEvent, &defaultActionEnabled); + nsresult rv = sharedWorker->DispatchEvent(errorEvent, &defaultActionEnabled); if (NS_FAILED(rv)) { Throw(cx, rv); JS_ReportPendingException(cx); From 4820eab88b1058925188dc3f5883c406980b57ee Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Thu, 12 Jun 2014 10:09:31 -0700 Subject: [PATCH 40/68] Bug 1024084: Clean up forward declarations and #includes in nsFrameManager.h and nsFrameManagerBase.h. r=jwatt --- layout/base/RestyleManager.h | 3 ++- layout/base/nsFrameManager.h | 8 ++++++-- layout/base/nsFrameManagerBase.h | 9 ++------- layout/style/AnimationCommon.h | 3 ++- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/layout/base/RestyleManager.h b/layout/base/RestyleManager.h index d5da7903971..f632e33bba9 100644 --- a/layout/base/RestyleManager.h +++ b/layout/base/RestyleManager.h @@ -16,8 +16,9 @@ #include "RestyleTracker.h" #include "nsPresContext.h" -class nsRefreshDriver; class nsIFrame; +class nsRefreshDriver; +class nsStyleChangeList; struct TreeMatchContext; namespace mozilla { diff --git a/layout/base/nsFrameManager.h b/layout/base/nsFrameManager.h index 455751b1d7a..fdc978f1305 100644 --- a/layout/base/nsFrameManager.h +++ b/layout/base/nsFrameManager.h @@ -19,11 +19,15 @@ #ifndef _nsFrameManager_h_ #define _nsFrameManager_h_ -#include "nsIFrame.h" #include "nsFrameManagerBase.h" + +#include "nsAutoPtr.h" +#include "nsFrameList.h" #include "nsIContent.h" +#include "nsStyleContext.h" class nsContainerFrame; +class nsPlaceholderFrame; namespace mozilla { /** @@ -75,7 +79,7 @@ struct UndisplayedNode { class nsFrameManager : public nsFrameManagerBase { - typedef nsIFrame::ChildListID ChildListID; + typedef mozilla::layout::FrameChildListID ChildListID; public: nsFrameManager(nsIPresShell *aPresShell, nsStyleSet* aStyleSet) { diff --git a/layout/base/nsFrameManagerBase.h b/layout/base/nsFrameManagerBase.h index 9fed423e7c6..b3f4c228094 100644 --- a/layout/base/nsFrameManagerBase.h +++ b/layout/base/nsFrameManagerBase.h @@ -19,17 +19,12 @@ #ifndef _nsFrameManagerBase_h_ #define _nsFrameManagerBase_h_ +#include "nsDebug.h" #include "pldhash.h" +class nsIFrame; class nsIPresShell; class nsStyleSet; -class nsIContent; -class nsPlaceholderFrame; -class nsIFrame; -class nsStyleContext; -class nsIAtom; -class nsStyleChangeList; -class nsILayoutHistoryState; class nsFrameManagerBase { diff --git a/layout/style/AnimationCommon.h b/layout/style/AnimationCommon.h index f1bbfc97daa..8adb4e9b8da 100644 --- a/layout/style/AnimationCommon.h +++ b/layout/style/AnimationCommon.h @@ -20,8 +20,9 @@ #include "mozilla/FloatingPoint.h" #include "nsCSSPseudoElements.h" -class nsPresContext; class nsIFrame; +class nsPresContext; +class nsStyleChangeList; class ElementPropertyTransition; From 3ed2bbef133e4fecad32281440350de0b8cc672c Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Thu, 12 Jun 2014 14:45:40 -0400 Subject: [PATCH 41/68] Backed out changesets d0ee7053aaf3 and c83f17cd74be (bug 727125) for B2G reftest failures. CLOSED TREE --- layout/base/RestyleManager.cpp | 26 +----- layout/base/RestyleManager.h | 3 - layout/base/nsChangeHint.h | 21 ++--- layout/generic/nsLineLayout.cpp | 26 +++--- layout/generic/nsTextFrame.cpp | 90 +++---------------- layout/generic/nsTextFrame.h | 4 +- ...underline-vertical-align-quirks-1-ref.html | 21 ----- ...mic-underline-vertical-align-quirks-1.html | 26 ------ ...underline-vertical-align-quirks-2-ref.html | 21 ----- ...mic-underline-vertical-align-quirks-2.html | 26 ------ ...erline-vertical-align-standards-1-ref.html | 22 ----- ...-underline-vertical-align-standards-1.html | 27 ------ ...erline-vertical-align-standards-2-ref.html | 22 ----- ...-underline-vertical-align-standards-2.html | 27 ------ layout/reftests/text-decoration/reftest.list | 4 - layout/style/nsStyleStruct.cpp | 12 ++- layout/style/nsStyleStruct.h | 4 +- 17 files changed, 47 insertions(+), 335 deletions(-) delete mode 100644 layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-1-ref.html delete mode 100644 layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-1.html delete mode 100644 layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-2-ref.html delete mode 100644 layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-2.html delete mode 100644 layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-1-ref.html delete mode 100644 layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-1.html delete mode 100644 layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-2-ref.html delete mode 100644 layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-2.html diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index 7019d949ea8..883186dc348 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -513,22 +513,6 @@ RestyleManager::StyleChangeReflow(nsIFrame* aFrame, nsChangeHint aHint) return; } -void -RestyleManager::AddSubtreeToOverflowTracker(nsIFrame* aFrame) -{ - mOverflowChangedTracker.AddFrame( - aFrame, - OverflowChangedTracker::CHILDREN_AND_PARENT_CHANGED); - nsIFrame::ChildListIterator lists(aFrame); - for (; !lists.IsDone(); lists.Next()) { - nsFrameList::Enumerator childFrames(lists.CurrentList()); - for (; !childFrames.AtEnd(); childFrames.Next()) { - nsIFrame* child = childFrames.get(); - AddSubtreeToOverflowTracker(child); - } - } -} - NS_DECLARE_FRAME_PROPERTY(ChangeListProperty, nullptr) /** @@ -732,7 +716,6 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList) StyleChangeReflow(frame, hint); didReflowThisFrame = true; } - if (hint & (nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView | nsChangeHint_UpdateOpacityLayer | nsChangeHint_UpdateTransformLayer | nsChangeHint_ChildrenOnlyTransform)) { @@ -750,11 +733,7 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList) "nsChangeHint_UpdateOverflow should be passed too"); if (!didReflowThisFrame && (hint & (nsChangeHint_UpdateOverflow | - nsChangeHint_UpdatePostTransformOverflow | - nsChangeHint_UpdateSubtreeOverflow))) { - if (hint & nsChangeHint_UpdateSubtreeOverflow) { - AddSubtreeToOverflowTracker(frame); - } + nsChangeHint_UpdatePostTransformOverflow))) { OverflowChangedTracker::ChangeKind changeKind; if (hint & nsChangeHint_ChildrenOnlyTransform) { // The overflow areas of the child frames need to be updated: @@ -790,8 +769,7 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList) // If we have both nsChangeHint_UpdateOverflow and // nsChangeHint_UpdatePostTransformOverflow, CHILDREN_AND_PARENT_CHANGED // is selected as it is stronger. - if (hint & (nsChangeHint_UpdateOverflow | - nsChangeHint_UpdateSubtreeOverflow)) { + if (hint & nsChangeHint_UpdateOverflow) { changeKind = OverflowChangedTracker::CHILDREN_AND_PARENT_CHANGED; } else { changeKind = OverflowChangedTracker::TRANSFORM_CHANGED; diff --git a/layout/base/RestyleManager.h b/layout/base/RestyleManager.h index f632e33bba9..027886fb00b 100644 --- a/layout/base/RestyleManager.h +++ b/layout/base/RestyleManager.h @@ -245,9 +245,6 @@ private: void StyleChangeReflow(nsIFrame* aFrame, nsChangeHint aHint); - // Recursively add all the given frame and all children to the tracker. - void AddSubtreeToOverflowTracker(nsIFrame* aFrame); - // Returns true if this function managed to successfully move a frame, and // false if it could not process the position change, and a reflow should // be performed instead. diff --git a/layout/base/nsChangeHint.h b/layout/base/nsChangeHint.h index 7acc5a2437c..79d5632a620 100644 --- a/layout/base/nsChangeHint.h +++ b/layout/base/nsChangeHint.h @@ -72,28 +72,23 @@ enum nsChangeHint { nsChangeHint_ReconstructFrame = 0x400, /** - * The frame's overflow area has changed. Does not update any descendant + * The frame's overflow area has changed, either through a change in its + * transform or a change in its position. Does not update any descendant * frames. */ nsChangeHint_UpdateOverflow = 0x800, - /** - * The overflow area of the frame and all of its descendants has changed. This - * can happen through a text-decoration change. - */ - nsChangeHint_UpdateSubtreeOverflow = 0x1000, - /** * The frame's overflow area has changed, through a change in its transform. * Does not update any descendant frames. */ - nsChangeHint_UpdatePostTransformOverflow = 0x2000, + nsChangeHint_UpdatePostTransformOverflow = 0x1000, /** * The children-only transform of an SVG frame changed, requiring the * overflow rects of the frame's immediate children to be updated. */ - nsChangeHint_ChildrenOnlyTransform = 0x4000, + nsChangeHint_ChildrenOnlyTransform = 0x2000, /** * The frame's offsets have changed, while its dimensions might have @@ -105,7 +100,7 @@ enum nsChangeHint { * nsChangeHint_UpdateOverflow in order to get the overflow areas of * the ancestors updated as well. */ - nsChangeHint_RecomputePosition = 0x8000, + nsChangeHint_RecomputePosition = 0x4000, /** * Behaves like ReconstructFrame, but only if the frame has descendants @@ -113,7 +108,7 @@ enum nsChangeHint { * has changed whether the frame is a container for fixed-pos or abs-pos * elements, but reframing is otherwise not needed. */ - nsChangeHint_AddOrRemoveTransform = 0x10000, + nsChangeHint_AddOrRemoveTransform = 0x8000, /** * This change hint has *no* change handling behavior. However, it @@ -121,13 +116,13 @@ enum nsChangeHint { * changes, and it's inherited by a child, that might require a reflow * due to the border-width change on the child. */ - nsChangeHint_BorderStyleNoneChange = 0x20000, + nsChangeHint_BorderStyleNoneChange = 0x10000, /** * SVG textPath needs to be recomputed because the path has changed. * This means that the glyph positions of the text need to be recomputed. */ - nsChangeHint_UpdateTextPath = 0x40000 + nsChangeHint_UpdateTextPath = 0x20000 // IMPORTANT NOTE: When adding new hints, consider whether you need to // add them to NS_HintsNotHandledForDescendantsIn() below. diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index 4784b15895e..605b164e7ad 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -731,16 +731,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, printf("\n"); #endif - if (mCurrentSpan == mRootSpan) { - pfd->mFrame->Properties().Remove(nsIFrame::LineBaselineOffset()); - } else { -#ifdef DEBUG - bool hasLineOffset; - pfd->mFrame->Properties().Get(nsIFrame::LineBaselineOffset(), &hasLineOffset); - NS_ASSERTION(!hasLineOffset, "LineBaselineOffset was set but was not expected"); -#endif - } - mTextJustificationNumSpaces = 0; mTextJustificationNumLetters = 0; @@ -1462,6 +1452,22 @@ nsLineLayout::BlockDirAlignLine() } PlaceStartEndFrames(psd, -mBStartEdge, lineBSize); + // If the frame being reflowed has text decorations, we simulate the + // propagation of those decorations to a line-level element by storing the + // offset in a frame property on any child frames that are aligned in the + // block direction somewhere other than the baseline. This property is then + // used by nsTextFrame::GetTextDecorations when the same conditions are met. + if (rootPFD.mFrame->StyleContext()->HasTextDecorationLines()) { + for (const PerFrameData* pfd = psd->mFirstFrame; pfd; pfd = pfd->mNext) { + const nsIFrame *const f = pfd->mFrame; + if (f->VerticalAlignEnum() != NS_STYLE_VERTICAL_ALIGN_BASELINE) { + const nscoord offset = baselineBCoord - pfd->mBounds.BStart(lineWM); + f->Properties().Set(nsIFrame::LineBaselineOffset(), + NS_INT32_TO_PTR(offset)); + } + } + } + // Fill in returned line-box and max-element-width data mLineBox->SetBounds(lineWM, psd->mIStart, mBStartEdge, diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index aab6d8ba77a..b692b6cd81c 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -4620,40 +4620,6 @@ PaintSelectionBackground(gfxContext* aCtx, nsPresContext* aPresContext, } } -// Attempt to get the LineBaselineOffset property of aChildFrame -// If not set, calculate this value for all child frames of aBlockFrame -static nscoord -LazyGetLineBaselineOffset(nsIFrame* aChildFrame, nsBlockFrame* aBlockFrame) -{ - bool offsetFound; - nscoord offset = NS_PTR_TO_INT32( - aChildFrame->Properties().Get(nsIFrame::LineBaselineOffset(), &offsetFound) - ); - - if (!offsetFound) { - for (nsBlockFrame::line_iterator line = aBlockFrame->begin_lines(), - line_end = aBlockFrame->end_lines(); - line != line_end; line++) { - if (line->IsInline()) { - int32_t n = line->GetChildCount(); - nscoord lineBaseline = line->BStart() + line->GetAscent(); - for (nsIFrame* lineFrame = line->mFirstChild; - n > 0; lineFrame = lineFrame->GetNextSibling(), --n) { - offset = lineBaseline - lineFrame->GetNormalPosition().y; - lineFrame->Properties().Set(nsIFrame::LineBaselineOffset(), - NS_INT32_TO_PTR(offset)); - } - } - } - return NS_PTR_TO_INT32( - aChildFrame->Properties().Get(nsIFrame::LineBaselineOffset(), &offsetFound) - ); - - } else { - return offset; - } -} - void nsTextFrame::GetTextDecorations( nsPresContext* aPresContext, @@ -4697,8 +4663,7 @@ nsTextFrame::GetTextDecorations( nsLayoutUtils::GetColor(f, eCSSProperty_text_decoration_color); } - nsBlockFrame* fBlock = nsLayoutUtils::GetAsBlock(f); - const bool firstBlock = !nearestBlockFound && fBlock; + const bool firstBlock = !nearestBlockFound && nsLayoutUtils::GetAsBlock(f); // Not updating positions once we hit a parent block is equivalent to // the CSS 2.1 spec that blocks should propagate decorations down to their @@ -4709,15 +4674,13 @@ nsTextFrame::GetTextDecorations( if (firstBlock) { // At this point, fChild can't be null since TextFrames can't be blocks if (fChild->VerticalAlignEnum() != NS_STYLE_VERTICAL_ALIGN_BASELINE) { - // Since offset is the offset in the child's coordinate space, we have // to undo the accumulation to bring the transform out of the block's // coordinate space - const nscoord lineBaselineOffset = LazyGetLineBaselineOffset(fChild, - fBlock); - baselineOffset = - frameTopOffset - fChild->GetNormalPosition().y - lineBaselineOffset; + frameTopOffset - fChild->GetNormalPosition().y + - NS_PTR_TO_INT32( + fChild->Properties().Get(nsIFrame::LineBaselineOffset())); } } else if (!nearestBlockFound) { @@ -4801,7 +4764,7 @@ GetInflationForTextDecorations(nsIFrame* aFrame, nscoord aInflationMinFontSize) void nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext, - nsIFrame* aBlock, + const nsHTMLReflowState& aBlockReflowState, PropertyProvider& aProvider, nsRect* aVisualOverflowRect, bool aIncludeTextDecorations) @@ -4814,8 +4777,8 @@ nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext, if (IsFloatingFirstLetterChild()) { // The underline/overline drawable area must be contained in the overflow // rect when this is in floating first letter frame at *both* modes. - // In this case, aBlock is the ::first-letter frame. - uint8_t decorationStyle = aBlock->StyleContext()-> + nsIFrame* firstLetterFrame = aBlockReflowState.frame; + uint8_t decorationStyle = firstLetterFrame->StyleContext()-> StyleTextReset()->GetDecorationStyle(); // If the style is none, let's include decoration line rect as solid style // since changing the style from none to solid/dotted/dashed doesn't cause @@ -4859,7 +4822,7 @@ nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext, GetTextDecorations(aPresContext, eResolvedColors, textDecs); if (textDecs.HasDecorationLines()) { nscoord inflationMinFontSize = - nsLayoutUtils::InflationMinFontSizeFor(aBlock); + nsLayoutUtils::InflationMinFontSizeFor(aBlockReflowState.frame); const nscoord width = GetSize().width; const gfxFloat appUnitsPerDevUnit = aPresContext->AppUnitsPerDevPixel(), @@ -8044,7 +8007,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth, // When we have text decorations, we don't need to compute their overflow now // because we're guaranteed to do it later // (see nsLineLayout::RelativePositionFrames) - UnionAdditionalOverflow(presContext, aLineLayout.LineContainerRS()->frame, + UnionAdditionalOverflow(presContext, *aLineLayout.LineContainerRS(), provider, &aMetrics.VisualOverflow(), false); ///////////////////////////////////////////////////////////////////// @@ -8286,7 +8249,7 @@ nsTextFrame::RecomputeOverflow(const nsHTMLReflowState& aBlockReflowState) &provider); nsRect &vis = result.VisualOverflow(); vis.UnionRect(vis, RoundOut(textMetrics.mBoundingBox) + nsPoint(0, mAscent)); - UnionAdditionalOverflow(PresContext(), aBlockReflowState.frame, provider, + UnionAdditionalOverflow(PresContext(), aBlockReflowState, provider, &vis, true); return result; } @@ -8577,36 +8540,3 @@ nsTextFrame::HasAnyNoncollapsedCharacters() int32_t skippedOffsetEnd = iter.ConvertOriginalToSkipped(offsetEnd); return skippedOffset != skippedOffsetEnd; } - -bool -nsTextFrame::UpdateOverflow() -{ - nsRect rect(nsPoint(0, 0), GetSize()); - nsOverflowAreas overflowAreas(rect, rect); - - if (GetStateBits() & NS_FRAME_FIRST_REFLOW) { - return false; - } - gfxSkipCharsIterator iter = EnsureTextRun(nsTextFrame::eInflated); - if (!mTextRun) { - return false; - } - PropertyProvider provider(this, iter, nsTextFrame::eInflated); - provider.InitializeForDisplay(true); - - nsIFrame*decorationsBlock; - if (IsFloatingFirstLetterChild()) { - decorationsBlock = GetParent(); - } else { - for (nsIFrame* f = this; f; f = f->GetParent()) { - nsBlockFrame* fBlock = nsLayoutUtils::GetAsBlock(f); - if (fBlock) { - decorationsBlock = fBlock; - break; - } - } - } - UnionAdditionalOverflow(PresContext(), decorationsBlock, provider, - &overflowAreas.VisualOverflow(), true); - return FinishAndStoreOverflow(overflowAreas, GetSize()); -} diff --git a/layout/generic/nsTextFrame.h b/layout/generic/nsTextFrame.h index 5b9575c1924..e7a28d1d981 100644 --- a/layout/generic/nsTextFrame.h +++ b/layout/generic/nsTextFrame.h @@ -519,8 +519,6 @@ public: bool IsFloatingFirstLetterChild() const; - virtual bool UpdateOverflow() MOZ_OVERRIDE; - protected: virtual ~nsTextFrame(); @@ -554,7 +552,7 @@ protected: SelectionDetails* GetSelectionDetails(); void UnionAdditionalOverflow(nsPresContext* aPresContext, - nsIFrame* aBlock, + const nsHTMLReflowState& aBlockReflowState, PropertyProvider& aProvider, nsRect* aVisualOverflowRect, bool aIncludeTextDecorations); diff --git a/layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-1-ref.html b/layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-1-ref.html deleted file mode 100644 index 915f3a7bb8f..00000000000 --- a/layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-1-ref.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - -

    -This line has a bottom vertical align span.
    -This line has a top vertical align span. -

    - - diff --git a/layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-1.html b/layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-1.html deleted file mode 100644 index eccaa3eb17e..00000000000 --- a/layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-1.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - -

    -This line has a bottom vertical align span.
    -This line has a top vertical align span. -

    - - diff --git a/layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-2-ref.html b/layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-2-ref.html deleted file mode 100644 index 7a1ba472fe5..00000000000 --- a/layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-2-ref.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - -

    -This line has only a bottom vertical align span.
    -This line has a top vertical align span. -

    - - diff --git a/layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-2.html b/layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-2.html deleted file mode 100644 index 52d5c5b62e0..00000000000 --- a/layout/reftests/text-decoration/dynamic-underline-vertical-align-quirks-2.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - -

    -This line has only a bottom vertical align span.
    -This line has a top vertical align span. -

    - - diff --git a/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-1-ref.html b/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-1-ref.html deleted file mode 100644 index 01ba4d9b6c9..00000000000 --- a/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-1-ref.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - -

    -This line has a bottom vertical align span.
    -This line has a top vertical align span. -

    - - diff --git a/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-1.html b/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-1.html deleted file mode 100644 index c285c02466b..00000000000 --- a/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-1.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - -

    -This line has a bottom vertical align span.
    -This line has a top vertical align span. -

    - - diff --git a/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-2-ref.html b/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-2-ref.html deleted file mode 100644 index fb465cce22b..00000000000 --- a/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-2-ref.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - -

    -This line has only a bottom vertical align span.
    -This line has a top vertical align span. -

    - - diff --git a/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-2.html b/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-2.html deleted file mode 100644 index e48816365a8..00000000000 --- a/layout/reftests/text-decoration/dynamic-underline-vertical-align-standards-2.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - -

    -This line has only a bottom vertical align span.
    -This line has a top vertical align span. -

    - - diff --git a/layout/reftests/text-decoration/reftest.list b/layout/reftests/text-decoration/reftest.list index cf21e509802..d4d5cca48db 100644 --- a/layout/reftests/text-decoration/reftest.list +++ b/layout/reftests/text-decoration/reftest.list @@ -4,10 +4,6 @@ skip-if(B2G) == complex-decoration-style-standards.html complex-decoration-style == decoration-color-standards.html decoration-color-standards-ref.html == decoration-style-quirks.html decoration-style-quirks-ref.html == decoration-style-standards.html decoration-style-standards-ref.html -== dynamic-underline-vertical-align-quirks-1.html dynamic-underline-vertical-align-quirks-1-ref.html -== dynamic-underline-vertical-align-standards-1.html dynamic-underline-vertical-align-standards-1-ref.html -== dynamic-underline-vertical-align-quirks-2.html dynamic-underline-vertical-align-quirks-2-ref.html -== dynamic-underline-vertical-align-standards-2.html dynamic-underline-vertical-align-standards-2-ref.html == line-through-style-block-solid-quirks.html line-through-style-block-quirks-ref.html != line-through-style-block-dotted-quirks.html line-through-style-block-quirks-ref.html != line-through-style-block-dashed-quirks.html line-through-style-block-quirks-ref.html diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 26d18bdf436..47d0748cce2 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -2992,11 +2992,17 @@ nsChangeHint nsStyleTextReset::CalcDifference(const nsStyleTextReset& aOther) co uint8_t otherLineStyle = aOther.GetDecorationStyle(); if (mTextDecorationLine != aOther.mTextDecorationLine || lineStyle != otherLineStyle) { + // Reflow for decoration line style changes only to or from double or + // wave because that may cause overflow area changes + if (lineStyle == NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE || + lineStyle == NS_STYLE_TEXT_DECORATION_STYLE_WAVY || + otherLineStyle == NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE || + otherLineStyle == NS_STYLE_TEXT_DECORATION_STYLE_WAVY) { + return NS_STYLE_HINT_REFLOW; + } // Repaint for other style decoration lines because they must be in // default overflow rect - nsChangeHint hint = NS_STYLE_HINT_VISUAL; - NS_UpdateHint(hint, nsChangeHint_UpdateSubtreeOverflow); - return hint; + return NS_STYLE_HINT_VISUAL; } // Repaint for decoration color changes diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index f4c4383d9d0..f162bf7a4ca 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -1480,9 +1480,7 @@ struct nsStyleTextReset { nsChangeHint CalcDifference(const nsStyleTextReset& aOther) const; static nsChangeHint MaxDifference() { - return nsChangeHint( - NS_STYLE_HINT_REFLOW | - nsChangeHint_UpdateSubtreeOverflow); + return NS_STYLE_HINT_REFLOW; } static nsChangeHint MaxDifferenceNeverInherited() { // CalcDifference never returns nsChangeHint_NeedReflow or From f027d0b87dc0f8223b1dfb71afde2b7ad2ee060c Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Thu, 12 Jun 2014 19:05:37 +0000 Subject: [PATCH 42/68] Bug 1024643: Create and upload D2D bitmaps in separate steps. r=mattwoodrow --- gfx/2d/SourceSurfaceD2D.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gfx/2d/SourceSurfaceD2D.cpp b/gfx/2d/SourceSurfaceD2D.cpp index da70dcc5ecb..73a04498888 100644 --- a/gfx/2d/SourceSurfaceD2D.cpp +++ b/gfx/2d/SourceSurfaceD2D.cpp @@ -69,13 +69,20 @@ SourceSurfaceD2D::InitFromData(unsigned char *aData, } D2D1_BITMAP_PROPERTIES props = D2D1::BitmapProperties(D2DPixelFormat(aFormat)); - hr = aRT->CreateBitmap(D2DIntSize(aSize), aData, aStride, props, byRef(mBitmap)); + hr = aRT->CreateBitmap(D2DIntSize(aSize), props, byRef(mBitmap)); if (FAILED(hr)) { gfxWarning() << "Failed to create D2D Bitmap for data. Code: " << hr; return false; } + hr = mBitmap->CopyFromMemory(nullptr, aData, aStride); + + if (FAILED(hr)) { + gfxWarning() << "Failed to copy data to D2D bitmap. Code: " << hr; + return false; + } + DrawTargetD2D::mVRAMUsageSS += GetByteSize(); mDevice = Factory::GetDirect3D10Device(); From 86242a14d8d1324195ed8cad6ccbe8a1fd9bf23d Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Thu, 12 Jun 2014 12:09:23 -0700 Subject: [PATCH 43/68] Bug 1024638: Use pandoc "--smart" documentation in js/src/doc documentation. DONTBUILD r=jorendorff --- js/src/doc/Debugger/Debugger-API.md | 10 +++++----- js/src/doc/format.sh | 6 +++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/js/src/doc/Debugger/Debugger-API.md b/js/src/doc/Debugger/Debugger-API.md index f33ec6f9efd..84a581688a6 100644 --- a/js/src/doc/Debugger/Debugger-API.md +++ b/js/src/doc/Debugger/Debugger-API.md @@ -41,7 +41,7 @@ of the additional attack surface. ## Debugger Instances and Shadow Objects `Debugger` reflects every aspect of the debuggee's state as a JavaScript -value—not just actual JavaScript values like objects and primitives, +value---not just actual JavaScript values like objects and primitives, but also stack frames, environments, scripts, and compilation units, which are not normally accessible as objects in their own right. @@ -57,7 +57,7 @@ Debugger API (which all follow some [general conventions][conventions]): invoking getters, setters, proxy traps, and so on. - A [`Debugger.Script`][script] represents a block of JavaScript - code—either a function body or a top-level script. Given a + code---either a function body or a top-level script. Given a `Debugger.Script`, one can set breakpoints, translate between source positions and bytecode offsets (a deviation from the "source level" design principle), and find other static characteristics of the code. @@ -154,7 +154,7 @@ You can try out `Debugger` yourself in Firefox's Scratchpad. ![The Debugger callback displaying an alert][img-example-alert] 7) Press "Run" in the Scratchpad again. Now, clicking on the "Click me!" - text causes *two* alerts to show—one for each `Debugger` + text causes *two* alerts to show---one for each `Debugger` instance. Multiple `Debugger` instances can observe the same debuggee. Re-running @@ -163,7 +163,7 @@ You can try out `Debugger` yourself in Firefox's Scratchpad. `debugger;` statement handler with the new instance. When you clicked on the `div` element, both of them ran. This shows how any number of `Debugger`-based tools can observe a single web page - simultaneously—although, since the order in which their handlers + simultaneously---although, since the order in which their handlers run is not specified, such tools should probably only observe, and not influence, the debuggee's behavior. @@ -185,6 +185,6 @@ While the `Debugger` core API deals only with concepts common to any JavaScript implementation, it also includes some Gecko-specific features: - [Global tracking][global] supports debugging all the code running in a - Gecko instance at once—the 'chrome debugging' model. + Gecko instance at once---the 'chrome debugging' model. - [Object wrapper][wrapper] functions help manipulate object references that cross privilege boundaries. diff --git a/js/src/doc/format.sh b/js/src/doc/format.sh index 917e5e7f4cc..754466bdfa1 100755 --- a/js/src/doc/format.sh +++ b/js/src/doc/format.sh @@ -83,7 +83,11 @@ markdown() { local output_file=$outputdir/${INPUT_FILE/md/html} mkdir -p $(dirname "$output_file") - pandoc $standalone_arg -f markdown "$file" <("$lib/make-bibliography.sh" $mdn_arg "$config" "$URL") -t html -o "$output_file" + pandoc $standalone_arg \ + -f markdown --smart -t html \ + "$file" \ + <("$lib/make-bibliography.sh" $mdn_arg "$config" "$URL") \ + -o "$output_file" "$lib/make-watermark.sh" "$output_file" "$hg_relative_sourcedir/$INPUT_FILE" >> "$output_file" } From 6b3fa8dfebc1ec8dbfd009e6b78a4fdc1fdfb048 Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Thu, 12 Jun 2014 20:24:05 +0100 Subject: [PATCH 44/68] Bug 1022821, part 2 - In gfx code, stop returning RefPtr and, where not an out-param, stop using RefPtr arguments. r=Cwiiis --- gfx/thebes/gfxPattern.cpp | 2 +- gfx/thebes/gfxPattern.h | 2 +- gfx/thebes/gfxPlatform.cpp | 28 ++++++++++++++-------------- gfx/thebes/gfxPlatform.h | 19 +++++++++++-------- gfx/thebes/gfxUtils.cpp | 6 +++--- gfx/thebes/gfxUtils.h | 6 +++--- widget/gtk/nsWindow.cpp | 11 +++++++---- 7 files changed, 40 insertions(+), 34 deletions(-) diff --git a/gfx/thebes/gfxPattern.cpp b/gfx/thebes/gfxPattern.cpp index c1b3be319e1..5074a783c1b 100644 --- a/gfx/thebes/gfxPattern.cpp +++ b/gfx/thebes/gfxPattern.cpp @@ -98,7 +98,7 @@ gfxPattern::AddColorStop(gfxFloat offset, const gfxRGBA& c) } void -gfxPattern::SetColorStops(mozilla::RefPtr aStops) +gfxPattern::SetColorStops(GradientStops* aStops) { mStops = aStops; } diff --git a/gfx/thebes/gfxPattern.h b/gfx/thebes/gfxPattern.h index 23b2a803b22..1f69574695e 100644 --- a/gfx/thebes/gfxPattern.h +++ b/gfx/thebes/gfxPattern.h @@ -38,7 +38,7 @@ public: cairo_pattern_t *CairoPattern(); void AddColorStop(gfxFloat offset, const gfxRGBA& c); - void SetColorStops(mozilla::RefPtr aStops); + void SetColorStops(mozilla::gfx::GradientStops* aStops); // This should only be called on a cairo pattern that we want to use with // Azure. We will read back the color stops from cairo and try to look diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 8f8f25944b5..1da54853812 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -534,19 +534,19 @@ gfxPlatform::~gfxPlatform() cairo_user_data_key_t kDrawTarget; -RefPtr +TemporaryRef gfxPlatform::CreateDrawTargetForSurface(gfxASurface *aSurface, const IntSize& aSize) { SurfaceFormat format = Optimal2DFormatForContent(aSurface->GetContentType()); RefPtr drawTarget = Factory::CreateDrawTargetForCairoSurface(aSurface->CairoSurface(), aSize, &format); aSurface->SetData(&kDrawTarget, drawTarget, nullptr); - return drawTarget; + return drawTarget.forget(); } // This is a temporary function used by ContentClient to build a DrawTarget // around the gfxASurface. This should eventually be replaced by plumbing // the DrawTarget through directly -RefPtr +TemporaryRef gfxPlatform::CreateDrawTargetForUpdateSurface(gfxASurface *aSurface, const IntSize& aSize) { #ifdef XP_MACOSX @@ -643,7 +643,7 @@ CopySurface(gfxASurface* aSurface) return data; } -/* static */ RefPtr +/* static */ TemporaryRef gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurface) { if (!aSurface->CairoSurface() || aSurface->CairoStatus()) { @@ -709,7 +709,7 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa if (srcBuffer) { // It's cheap enough to make a new one so we won't keep it around and // keeping it creates a cycle. - return srcBuffer; + return srcBuffer.forget(); } } @@ -734,7 +734,7 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa // Our wrapping surface will hold a reference to its image surface. We cause // a reference cycle if we add it to the cache. And caching it is pretty // pointless since we'll just wrap it again next use. - return srcBuffer; + return srcBuffer.forget(); } } @@ -744,10 +744,10 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa srcSurfUD->mSrcSurface = srcBuffer; aSurface->SetData(&kSourceSurface, srcSurfUD, SourceBufferDestroy); - return srcBuffer; + return srcBuffer.forget(); } -RefPtr +TemporaryRef gfxPlatform::GetWrappedDataSourceSurface(gfxASurface* aSurface) { nsRefPtr image = aSurface->GetAsImageSurface(); @@ -770,7 +770,7 @@ gfxPlatform::GetWrappedDataSourceSurface(gfxASurface* aSurface) srcSurfUD->mSurface = aSurface; result->AddUserData(&kThebesSurface, srcSurfUD, SourceSurfaceDestroyed); - return result; + return result.forget(); } TemporaryRef @@ -927,7 +927,7 @@ gfxPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget) return surf.forget(); } -RefPtr +TemporaryRef gfxPlatform::CreateDrawTargetForBackend(BackendType aBackend, const IntSize& aSize, SurfaceFormat aFormat) { // There is a bunch of knowledge in the gfxPlatform heirarchy about how to @@ -951,27 +951,27 @@ gfxPlatform::CreateDrawTargetForBackend(BackendType aBackend, const IntSize& aSi } } -RefPtr +TemporaryRef gfxPlatform::CreateOffscreenCanvasDrawTarget(const IntSize& aSize, SurfaceFormat aFormat) { NS_ASSERTION(mPreferredCanvasBackend != BackendType::NONE, "No backend."); RefPtr target = CreateDrawTargetForBackend(mPreferredCanvasBackend, aSize, aFormat); if (target || mFallbackCanvasBackend == BackendType::NONE) { - return target; + return target.forget(); } return CreateDrawTargetForBackend(mFallbackCanvasBackend, aSize, aFormat); } -RefPtr +TemporaryRef gfxPlatform::CreateOffscreenContentDrawTarget(const IntSize& aSize, SurfaceFormat aFormat) { NS_ASSERTION(mPreferredCanvasBackend != BackendType::NONE, "No backend."); return CreateDrawTargetForBackend(mContentBackend, aSize, aFormat); } -RefPtr +TemporaryRef gfxPlatform::CreateDrawTargetForData(unsigned char* aData, const IntSize& aSize, int32_t aStride, SurfaceFormat aFormat) { NS_ASSERTION(mContentBackend != BackendType::NONE, "No backend."); diff --git a/gfx/thebes/gfxPlatform.h b/gfx/thebes/gfxPlatform.h index 24e38663fcf..62abdbcbbfe 100644 --- a/gfx/thebes/gfxPlatform.h +++ b/gfx/thebes/gfxPlatform.h @@ -155,7 +155,10 @@ GetBackendName(mozilla::gfx::BackendType aBackend) class gfxPlatform { public: + typedef mozilla::gfx::DataSourceSurface DataSourceSurface; + typedef mozilla::gfx::DrawTarget DrawTarget; typedef mozilla::gfx::IntSize IntSize; + typedef mozilla::gfx::SourceSurface SourceSurface; /** * Return a pointer to the current active platform. @@ -187,10 +190,10 @@ public: * support the DrawTarget we get back. * See SupportsAzureContentForDrawTarget. */ - virtual mozilla::RefPtr + virtual mozilla::TemporaryRef CreateDrawTargetForSurface(gfxASurface *aSurface, const mozilla::gfx::IntSize& aSize); - virtual mozilla::RefPtr + virtual mozilla::TemporaryRef CreateDrawTargetForUpdateSurface(gfxASurface *aSurface, const mozilla::gfx::IntSize& aSize); /* @@ -205,12 +208,12 @@ public: * PluginInstanceChild (where we can't call gfxPlatform::GetPlatform() * because the prefs service can only be accessed from the main process). */ - static mozilla::RefPtr + static mozilla::TemporaryRef GetSourceSurfaceForSurface(mozilla::gfx::DrawTarget *aTarget, gfxASurface *aSurface); static void ClearSourceSurfaceForSurface(gfxASurface *aSurface); - static mozilla::RefPtr + static mozilla::TemporaryRef GetWrappedDataSourceSurface(gfxASurface *aSurface); virtual mozilla::TemporaryRef @@ -219,13 +222,13 @@ public: virtual already_AddRefed GetThebesSurfaceForDrawTarget(mozilla::gfx::DrawTarget *aTarget); - mozilla::RefPtr + mozilla::TemporaryRef CreateOffscreenContentDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat); - mozilla::RefPtr + mozilla::TemporaryRef CreateOffscreenCanvasDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat); - virtual mozilla::RefPtr + virtual mozilla::TemporaryRef CreateDrawTargetForData(unsigned char* aData, const mozilla::gfx::IntSize& aSize, int32_t aStride, mozilla::gfx::SurfaceFormat aFormat); @@ -557,7 +560,7 @@ protected: * Helper method, creates a draw target for a specific Azure backend. * Used by CreateOffscreenDrawTarget. */ - mozilla::RefPtr + mozilla::TemporaryRef CreateDrawTargetForBackend(mozilla::gfx::BackendType aBackend, const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat); diff --git a/gfx/thebes/gfxUtils.cpp b/gfx/thebes/gfxUtils.cpp index fc781718fbe..9f99493e9f5 100644 --- a/gfx/thebes/gfxUtils.cpp +++ b/gfx/thebes/gfxUtils.cpp @@ -965,7 +965,7 @@ gfxUtils::CopyAsDataURL(DrawTarget* aDT) } /* static */ void -gfxUtils::WriteAsPNG(RefPtr aSourceSurface, const char* aFile) +gfxUtils::WriteAsPNG(gfx::SourceSurface* aSourceSurface, const char* aFile) { RefPtr dataSurface = aSourceSurface->GetDataSurface(); RefPtr dt @@ -978,7 +978,7 @@ gfxUtils::WriteAsPNG(RefPtr aSourceSurface, const char* aFil } /* static */ void -gfxUtils::DumpAsDataURL(RefPtr aSourceSurface) +gfxUtils::DumpAsDataURL(gfx::SourceSurface* aSourceSurface) { RefPtr dataSurface = aSourceSurface->GetDataSurface(); RefPtr dt @@ -991,7 +991,7 @@ gfxUtils::DumpAsDataURL(RefPtr aSourceSurface) } /* static */ void -gfxUtils::CopyAsDataURL(RefPtr aSourceSurface) +gfxUtils::CopyAsDataURL(gfx::SourceSurface* aSourceSurface) { RefPtr dataSurface = aSourceSurface->GetDataSurface(); RefPtr dt diff --git a/gfx/thebes/gfxUtils.h b/gfx/thebes/gfxUtils.h index d807b05345c..bcbfb1cf880 100644 --- a/gfx/thebes/gfxUtils.h +++ b/gfx/thebes/gfxUtils.h @@ -240,19 +240,19 @@ public: * Writes a binary PNG file. * Expensive. Creates a DataSourceSurface, then a DrawTarget, then passes to DrawTarget overloads */ - static void WriteAsPNG(mozilla::RefPtr aSourceSurface, const char* aFile); + static void WriteAsPNG(mozilla::gfx::SourceSurface* aSourceSurface, const char* aFile); /** * Write as a PNG encoded Data URL to stdout. * Expensive. Creates a DataSourceSurface, then a DrawTarget, then passes to DrawTarget overloads */ - static void DumpAsDataURL(mozilla::RefPtr aSourceSurface); + static void DumpAsDataURL(mozilla::gfx::SourceSurface* aSourceSurface); /** * Copy a PNG encoded Data URL to the clipboard. * Expensive. Creates a DataSourceSurface, then a DrawTarget, then passes to DrawTarget overloads */ - static void CopyAsDataURL(mozilla::RefPtr aSourceSurface); + static void CopyAsDataURL(mozilla::gfx::SourceSurface* aSourceSurface); #endif }; diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp index 4f25b9b756c..04dd30bf713 100644 --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -2135,16 +2135,19 @@ nsWindow::OnExposeEvent(cairo_t *cr) if (gfxPlatform::GetPlatform()-> SupportsAzureContentForType(BackendType::CAIRO)) { IntSize intSize(surf->GetSize().width, surf->GetSize().height); - ctx = new gfxContext(gfxPlatform::GetPlatform()-> - CreateDrawTargetForSurface(surf, intSize)); + RefPtr dt = + gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(surf, intSize); + ctx = new gfxContext(dt); } else if (gfxPlatform::GetPlatform()-> SupportsAzureContentForType(BackendType::SKIA) && surf->GetType() == gfxSurfaceType::Image) { gfxImageSurface* imgSurf = static_cast(surf); SurfaceFormat format = ImageFormatToSurfaceFormat(imgSurf->Format()); IntSize intSize(surf->GetSize().width, surf->GetSize().height); - ctx = new gfxContext(gfxPlatform::GetPlatform()->CreateDrawTargetForData( - imgSurf->Data(), intSize, imgSurf->Stride(), format)); + RefPtr dt = + gfxPlatform::GetPlatform()->CreateDrawTargetForData( + imgSurf->Data(), intSize, imgSurf->Stride(), format); + ctx = new gfxContext(dt); } else { ctx = new gfxContext(surf); } From e6f41c18a9219279e9f70fce6f7ef4284fd87319 Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Thu, 12 Jun 2014 20:25:33 +0100 Subject: [PATCH 45/68] Bug 1016680, part 4 - Explicitly initialize members in nsFrameManagerBase's ctor rather than using memset. r=bz --- layout/base/nsFrameManagerBase.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/layout/base/nsFrameManagerBase.h b/layout/base/nsFrameManagerBase.h index b3f4c228094..bd6b4969a13 100644 --- a/layout/base/nsFrameManagerBase.h +++ b/layout/base/nsFrameManagerBase.h @@ -30,8 +30,13 @@ class nsFrameManagerBase { public: nsFrameManagerBase() + : mPresShell(nullptr) + , mStyleSet(nullptr) + , mRootFrame(nullptr) + , mUndisplayedMap(nullptr) + , mIsDestroyingFrames(false) { - memset(this, '\0', sizeof(nsFrameManagerBase)); + mPlaceholderMap.ops = nullptr; } bool IsDestroyingFrames() { return mIsDestroyingFrames; } From be6245602f45c94d42d79aafccc0f3d56ed5f964 Mon Sep 17 00:00:00 2001 From: Shu-yu Guo Date: Thu, 12 Jun 2014 12:46:17 -0700 Subject: [PATCH 46/68] Bug 1022891 - Part 1: Fix IonBailoutIterator for non-top frames. (r=nbp) --- js/src/jit/Bailouts.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/js/src/jit/Bailouts.h b/js/src/jit/Bailouts.h index 362e97bce83..086810af4c8 100644 --- a/js/src/jit/Bailouts.h +++ b/js/src/jit/Bailouts.h @@ -125,11 +125,14 @@ class IonBailoutIterator : public JitFrameIterator IonBailoutIterator(const JitActivationIterator &activations, const JitFrameIterator &frame); SnapshotOffset snapshotOffset() const { - JS_ASSERT(topIonScript_); - return snapshotOffset_; + if (topIonScript_) + return snapshotOffset_; + return osiIndex()->snapshotOffset(); } - const MachineState &machineState() const { - return machine_; + const MachineState machineState() const { + if (topIonScript_) + return machine_; + return JitFrameIterator::machineState(); } size_t topFrameSize() const { JS_ASSERT(topIonScript_); @@ -141,6 +144,14 @@ class IonBailoutIterator : public JitFrameIterator return JitFrameIterator::ionScript(); } + IonBailoutIterator &operator++() { + JitFrameIterator::operator++(); + // Clear topIonScript_ now that we've advanced past it, so that + // snapshotOffset() and machineState() reflect the current script. + topIonScript_ = nullptr; + return *this; + } + void dump() const; }; From a8aa3e16f094d37837b8f4f4aa50f3cba7ad8ebb Mon Sep 17 00:00:00 2001 From: Shu-yu Guo Date: Thu, 12 Jun 2014 12:46:17 -0700 Subject: [PATCH 47/68] Bug 1022891 - Part 2: Teach IonBailoutIterator about PJS scripts. (r=nbp) --- js/src/jit/IonFrames.cpp | 9 ++++++++- js/src/jit/arm/Bailouts-arm.cpp | 6 +++++- js/src/jit/mips/Bailouts-mips.cpp | 6 +++++- js/src/jit/x64/Bailouts-x64.cpp | 6 +++++- js/src/jit/x86/Bailouts-x86.cpp | 6 +++++- 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/js/src/jit/IonFrames.cpp b/js/src/jit/IonFrames.cpp index bd5652881d9..4d6268ed563 100644 --- a/js/src/jit/IonFrames.cpp +++ b/js/src/jit/IonFrames.cpp @@ -1698,7 +1698,14 @@ JitFrameIterator::ionScriptFromCalleeToken() const switch (GetCalleeTokenTag(calleeToken())) { case CalleeToken_Function: case CalleeToken_Script: - return mode_ == ParallelExecution ? script()->parallelIonScript() : script()->ionScript(); + switch (mode_) { + case SequentialExecution: + return script()->ionScript(); + case ParallelExecution: + return script()->parallelIonScript(); + default: + MOZ_ASSUME_UNREACHABLE("No such execution mode"); + } default: MOZ_ASSUME_UNREACHABLE("unknown callee token type"); } diff --git a/js/src/jit/arm/Bailouts-arm.cpp b/js/src/jit/arm/Bailouts-arm.cpp index 752d3bb40f6..807470a98e0 100644 --- a/js/src/jit/arm/Bailouts-arm.cpp +++ b/js/src/jit/arm/Bailouts-arm.cpp @@ -79,7 +79,11 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations, current_ = fp; type_ = JitFrame_IonJS; topFrameSize_ = current_ - sp; - topIonScript_ = script()->ionScript(); + switch (mode_) { + case SequentialExecution: topIonScript_ = script()->ionScript(); break; + case ParallelExecution: topIonScript_ = script()->parallelIonScript(); break; + default: MOZ_ASSUME_UNREACHABLE("No such execution mode"); + } if (bailout->frameClass() == FrameSizeClass::None()) { snapshotOffset_ = bailout->snapshotOffset(); diff --git a/js/src/jit/mips/Bailouts-mips.cpp b/js/src/jit/mips/Bailouts-mips.cpp index 2e12628b4f9..141f0527507 100644 --- a/js/src/jit/mips/Bailouts-mips.cpp +++ b/js/src/jit/mips/Bailouts-mips.cpp @@ -23,7 +23,11 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations, current_ = fp; type_ = JitFrame_IonJS; topFrameSize_ = current_ - sp; - topIonScript_ = script()->ionScript(); + switch (mode_) { + case SequentialExecution: topIonScript_ = script()->ionScript(); break; + case ParallelExecution: topIonScript_ = script()->parallelIonScript(); break; + default: MOZ_ASSUME_UNREACHABLE("No such execution mode"); + } if (bailout->frameClass() == FrameSizeClass::None()) { snapshotOffset_ = bailout->snapshotOffset(); diff --git a/js/src/jit/x64/Bailouts-x64.cpp b/js/src/jit/x64/Bailouts-x64.cpp index 9bd803e1f9c..75ecaa32098 100644 --- a/js/src/jit/x64/Bailouts-x64.cpp +++ b/js/src/jit/x64/Bailouts-x64.cpp @@ -56,7 +56,11 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations, current_ = fp; type_ = JitFrame_IonJS; topFrameSize_ = current_ - sp; - topIonScript_ = script()->ionScript(); + switch (mode_) { + case SequentialExecution: topIonScript_ = script()->ionScript(); break; + case ParallelExecution: topIonScript_ = script()->parallelIonScript(); break; + default: MOZ_ASSUME_UNREACHABLE("No such execution mode"); + } snapshotOffset_ = bailout->snapshotOffset(); } diff --git a/js/src/jit/x86/Bailouts-x86.cpp b/js/src/jit/x86/Bailouts-x86.cpp index 2e0367d1082..c7df7aeb2fb 100644 --- a/js/src/jit/x86/Bailouts-x86.cpp +++ b/js/src/jit/x86/Bailouts-x86.cpp @@ -76,7 +76,11 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations, current_ = fp; type_ = JitFrame_IonJS; topFrameSize_ = current_ - sp; - topIonScript_ = script()->ionScript(); + switch (mode_) { + case SequentialExecution: topIonScript_ = script()->ionScript(); break; + case ParallelExecution: topIonScript_ = script()->parallelIonScript(); break; + default: MOZ_ASSUME_UNREACHABLE("No such execution mode"); + } if (bailout->frameClass() == FrameSizeClass::None()) { snapshotOffset_ = bailout->snapshotOffset(); From 3f4ec4ee245ce5e3368e0d499e210c2a04ca042a Mon Sep 17 00:00:00 2001 From: Shu-yu Guo Date: Thu, 12 Jun 2014 12:46:17 -0700 Subject: [PATCH 48/68] Bug 1022891 - Part 3: Fix instantiating InlineFrameIterator from inside InlineFrameIterator when settled on a bailout frame. (r=nbp) --- js/src/jit/Bailouts.cpp | 1 + js/src/jit/IonFrames.cpp | 44 +++++++++++++++++++++++-------- js/src/jit/JitFrameIterator.h | 19 ++++++++++--- js/src/jit/arm/Bailouts-arm.cpp | 2 ++ js/src/jit/mips/Bailouts-mips.cpp | 2 ++ js/src/jit/x64/Bailouts-x64.cpp | 2 ++ js/src/jit/x86/Bailouts-x86.cpp | 2 ++ 7 files changed, 57 insertions(+), 15 deletions(-) diff --git a/js/src/jit/Bailouts.cpp b/js/src/jit/Bailouts.cpp index a696078d7d0..6c9b08cce96 100644 --- a/js/src/jit/Bailouts.cpp +++ b/js/src/jit/Bailouts.cpp @@ -192,6 +192,7 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations, : JitFrameIterator(activations), machine_(frame.machineState()) { + kind_ = Kind_BailoutIterator; returnAddressToFp_ = frame.returnAddressToFp(); topIonScript_ = frame.ionScript(); const OsiIndex *osiIndex = frame.osiIndex(); diff --git a/js/src/jit/IonFrames.cpp b/js/src/jit/IonFrames.cpp index 4d6268ed563..0e0ac67fa9a 100644 --- a/js/src/jit/IonFrames.cpp +++ b/js/src/jit/IonFrames.cpp @@ -83,20 +83,23 @@ JitFrameIterator::JitFrameIterator(ThreadSafeContext *cx) type_(JitFrame_Exit), returnAddressToFp_(nullptr), frameSize_(0), + mode_(cx->isForkJoinContext() ? ParallelExecution : SequentialExecution), + kind_(Kind_FrameIterator), cachedSafepointIndex_(nullptr), - activation_(nullptr), - mode_(cx->isForkJoinContext() ? ParallelExecution : SequentialExecution) + activation_(nullptr) { } JitFrameIterator::JitFrameIterator(const ActivationIterator &activations) - : current_(activations.jitTop()), - type_(JitFrame_Exit), - returnAddressToFp_(nullptr), - frameSize_(0), - cachedSafepointIndex_(nullptr), - activation_(activations->asJit()), - mode_(activation_->cx()->isForkJoinContext() ? ParallelExecution : SequentialExecution) + : current_(activations.jitTop()), + type_(JitFrame_Exit), + returnAddressToFp_(nullptr), + frameSize_(0), + mode_(activations->asJit()->cx()->isForkJoinContext() ? ParallelExecution + : SequentialExecution), + kind_(Kind_FrameIterator), + cachedSafepointIndex_(nullptr), + activation_(activations->asJit()) { } @@ -105,10 +108,25 @@ JitFrameIterator::JitFrameIterator(IonJSFrameLayout *fp, ExecutionMode mode) type_(JitFrame_IonJS), returnAddressToFp_(fp->returnAddress()), frameSize_(fp->prevFrameLocalSize()), - mode_(mode) + mode_(mode), + kind_(Kind_FrameIterator) { } +IonBailoutIterator * +JitFrameIterator::asBailoutIterator() +{ + MOZ_ASSERT(isBailoutIterator()); + return static_cast(this); +} + +const IonBailoutIterator * +JitFrameIterator::asBailoutIterator() const +{ + MOZ_ASSERT(isBailoutIterator()); + return static_cast(this); +} + bool JitFrameIterator::checkInvalidation() const { @@ -1761,7 +1779,11 @@ InlineFrameIterator::InlineFrameIterator(ThreadSafeContext *cx, const InlineFram script_(cx) { if (frame_) { - start_ = SnapshotIterator(*frame_); + if (frame_->isBailoutIterator()) + start_ = SnapshotIterator(*frame_->asBailoutIterator()); + else + start_ = SnapshotIterator(*frame_); + // findNextFrame will iterate to the next frame and init. everything. // Therefore to settle on the same frame, we report one frame less readed. framesRead_ = iter->framesRead_ - 1; diff --git a/js/src/jit/JitFrameIterator.h b/js/src/jit/JitFrameIterator.h index 972ee9d7541..f720713c7eb 100644 --- a/js/src/jit/JitFrameIterator.h +++ b/js/src/jit/JitFrameIterator.h @@ -76,6 +76,7 @@ enum ReadFrameArgsBehavior { class IonCommonFrameLayout; class IonJSFrameLayout; class IonExitFrameLayout; +class IonBailoutIterator; class BaselineFrame; @@ -88,11 +89,15 @@ class JitFrameIterator FrameType type_; uint8_t *returnAddressToFp_; size_t frameSize_; + ExecutionMode mode_; + enum Kind { + Kind_FrameIterator, + Kind_BailoutIterator + } kind_; private: mutable const SafepointIndex *cachedSafepointIndex_; const JitActivation *activation_; - ExecutionMode mode_; void dumpBaseline() const; @@ -102,15 +107,22 @@ class JitFrameIterator type_(JitFrame_Exit), returnAddressToFp_(nullptr), frameSize_(0), + mode_(mode), + kind_(Kind_FrameIterator), cachedSafepointIndex_(nullptr), - activation_(nullptr), - mode_(mode) + activation_(nullptr) { } explicit JitFrameIterator(ThreadSafeContext *cx); explicit JitFrameIterator(const ActivationIterator &activations); explicit JitFrameIterator(IonJSFrameLayout *fp, ExecutionMode mode); + bool isBailoutIterator() const { + return kind_ == Kind_BailoutIterator; + } + IonBailoutIterator *asBailoutIterator(); + const IonBailoutIterator *asBailoutIterator() const; + // Current frame information. FrameType type() const { return type_; @@ -247,7 +259,6 @@ class JitFrameIterator }; class IonJSFrameLayout; -class IonBailoutIterator; class RResumePoint; diff --git a/js/src/jit/arm/Bailouts-arm.cpp b/js/src/jit/arm/Bailouts-arm.cpp index 807470a98e0..2de002b3a9d 100644 --- a/js/src/jit/arm/Bailouts-arm.cpp +++ b/js/src/jit/arm/Bailouts-arm.cpp @@ -76,6 +76,7 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations, uint8_t *sp = bailout->parentStackPointer(); uint8_t *fp = sp + bailout->frameSize(); + kind_ = Kind_BailoutIterator; current_ = fp; type_ = JitFrame_IonJS; topFrameSize_ = current_ - sp; @@ -112,6 +113,7 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations, : JitFrameIterator(activations), machine_(bailout->machine()) { + kind_ = Kind_BailoutIterator; returnAddressToFp_ = bailout->osiPointReturnAddress(); topIonScript_ = bailout->ionScript(); const OsiIndex *osiIndex = topIonScript_->getOsiIndex(returnAddressToFp_); diff --git a/js/src/jit/mips/Bailouts-mips.cpp b/js/src/jit/mips/Bailouts-mips.cpp index 141f0527507..0196365850e 100644 --- a/js/src/jit/mips/Bailouts-mips.cpp +++ b/js/src/jit/mips/Bailouts-mips.cpp @@ -20,6 +20,7 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations, uint8_t *sp = bailout->parentStackPointer(); uint8_t *fp = sp + bailout->frameSize(); + kind_ = Kind_BailoutIterator; current_ = fp; type_ = JitFrame_IonJS; topFrameSize_ = current_ - sp; @@ -56,6 +57,7 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations, : JitFrameIterator(activations), machine_(bailout->machine()) { + kind_ = Kind_BailoutIterator; returnAddressToFp_ = bailout->osiPointReturnAddress(); topIonScript_ = bailout->ionScript(); const OsiIndex *osiIndex = topIonScript_->getOsiIndex(returnAddressToFp_); diff --git a/js/src/jit/x64/Bailouts-x64.cpp b/js/src/jit/x64/Bailouts-x64.cpp index 75ecaa32098..3f8bb8ad7fe 100644 --- a/js/src/jit/x64/Bailouts-x64.cpp +++ b/js/src/jit/x64/Bailouts-x64.cpp @@ -53,6 +53,7 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations, uint8_t *sp = bailout->parentStackPointer(); uint8_t *fp = sp + bailout->frameSize(); + kind_ = Kind_BailoutIterator; current_ = fp; type_ = JitFrame_IonJS; topFrameSize_ = current_ - sp; @@ -69,6 +70,7 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations, : JitFrameIterator(activations), machine_(bailout->machine()) { + kind_ = Kind_BailoutIterator; returnAddressToFp_ = bailout->osiPointReturnAddress(); topIonScript_ = bailout->ionScript(); const OsiIndex *osiIndex = topIonScript_->getOsiIndex(returnAddressToFp_); diff --git a/js/src/jit/x86/Bailouts-x86.cpp b/js/src/jit/x86/Bailouts-x86.cpp index c7df7aeb2fb..aab1f2af312 100644 --- a/js/src/jit/x86/Bailouts-x86.cpp +++ b/js/src/jit/x86/Bailouts-x86.cpp @@ -73,6 +73,7 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations, uint8_t *sp = bailout->parentStackPointer(); uint8_t *fp = sp + bailout->frameSize(); + kind_ = Kind_BailoutIterator; current_ = fp; type_ = JitFrame_IonJS; topFrameSize_ = current_ - sp; @@ -109,6 +110,7 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations, : JitFrameIterator(activations), machine_(bailout->machine()) { + kind_ = Kind_BailoutIterator; returnAddressToFp_ = bailout->osiPointReturnAddress(); topIonScript_ = bailout->ionScript(); const OsiIndex *osiIndex = topIonScript_->getOsiIndex(returnAddressToFp_); From 039ebd8dbe72e89ec5ac0260212099e1ab8df580 Mon Sep 17 00:00:00 2001 From: Milan Sreckovic Date: Thu, 12 Jun 2014 10:54:43 -0400 Subject: [PATCH 49/68] Bug 1019257: Canvas pattern setTransform exposed through WebIDL. r=gw280,bz. --HG-- extra : rebase_source : a12b913bf1cfeb11313aa1525d1ebcae075e1456 --- content/canvas/src/CanvasPattern.h | 6 ++ .../canvas/src/CanvasRenderingContext2D.cpp | 10 ++- content/canvas/test/mochitest.ini | 1 + ..._composite_canvaspattern_setTransform.html | 77 +++++++++++++++++++ dom/webidl/CanvasRenderingContext2D.webidl | 6 +- 5 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 content/canvas/test/test_2d_composite_canvaspattern_setTransform.html diff --git a/content/canvas/src/CanvasPattern.h b/content/canvas/src/CanvasPattern.h index 8d638431024..4450b99a4db 100644 --- a/content/canvas/src/CanvasPattern.h +++ b/content/canvas/src/CanvasPattern.h @@ -20,6 +20,7 @@ class SourceSurface; } namespace dom { +class SVGMatrix; class CanvasPattern MOZ_FINAL : public nsWrapperCache { @@ -43,6 +44,7 @@ public: : mContext(aContext) , mSurface(aSurface) , mPrincipal(principalForSecurityCheck) + , mTransform() , mForceWriteOnly(forceWriteOnly) , mCORSUsed(CORSUsed) , mRepeat(aRepeat) @@ -60,9 +62,13 @@ public: return mContext; } + // WebIDL + void SetTransform(SVGMatrix& matrix); + nsRefPtr mContext; RefPtr mSurface; nsCOMPtr mPrincipal; + mozilla::gfx::Matrix mTransform; const bool mForceWriteOnly; const bool mCORSUsed; const RepeatMode mRepeat; diff --git a/content/canvas/src/CanvasRenderingContext2D.cpp b/content/canvas/src/CanvasRenderingContext2D.cpp index f934fc26b10..b0aa16fdbe1 100644 --- a/content/canvas/src/CanvasRenderingContext2D.cpp +++ b/content/canvas/src/CanvasRenderingContext2D.cpp @@ -93,6 +93,7 @@ #include "mozilla/dom/HTMLVideoElement.h" #include "mozilla/dom/TextMetrics.h" #include "mozilla/dom/UnionTypes.h" +#include "mozilla/dom/SVGMatrix.h" #include "nsGlobalWindow.h" #include "GLContext.h" #include "GLContextProvider.h" @@ -262,7 +263,8 @@ public: mode = ExtendMode::REPEAT; } mPattern = new (mSurfacePattern.addr()) - SurfacePattern(state.patternStyles[aStyle]->mSurface, mode); + SurfacePattern(state.patternStyles[aStyle]->mSurface, mode, + state.patternStyles[aStyle]->mTransform); } return *mPattern; @@ -382,6 +384,12 @@ private: mgfx::Rect mTempRect; }; +void +CanvasPattern::SetTransform(SVGMatrix& aMatrix) +{ + mTransform = ToMatrix(aMatrix.GetMatrix()); +} + void CanvasGradient::AddColorStop(float offset, const nsAString& colorstr, ErrorResult& rv) { diff --git a/content/canvas/test/mochitest.ini b/content/canvas/test/mochitest.ini index e03c2ce473b..3cc8ed46666 100644 --- a/content/canvas/test/mochitest.ini +++ b/content/canvas/test/mochitest.ini @@ -214,5 +214,6 @@ skip-if = (buildapp == 'b2g' && toolkit != 'gonk') [test_toDataURL_parameters.html] [test_windingRuleUndefined.html] [test_2d.fillText.gradient.html] +[test_2d_composite_canvaspattern_setTransform.html] [test_createPattern_broken.html] [test_setlinedash.html] diff --git a/content/canvas/test/test_2d_composite_canvaspattern_setTransform.html b/content/canvas/test/test_2d_composite_canvaspattern_setTransform.html new file mode 100644 index 00000000000..67a9f6634a8 --- /dev/null +++ b/content/canvas/test/test_2d_composite_canvaspattern_setTransform.html @@ -0,0 +1,77 @@ + +Canvas Tests + + + + + +

    Canvas test: 2d.composite.canvaspattern.setTransform

    +

    FAIL +(fallback content)

    + + + + + + + diff --git a/dom/webidl/CanvasRenderingContext2D.webidl b/dom/webidl/CanvasRenderingContext2D.webidl index 8815d8f5eb5..bb7e2767b6f 100644 --- a/dom/webidl/CanvasRenderingContext2D.webidl +++ b/dom/webidl/CanvasRenderingContext2D.webidl @@ -286,7 +286,11 @@ interface CanvasGradient { interface CanvasPattern { // opaque object - // void setTransform(SVGMatrix transform); + // [Throws, LenientFloat] - could not do this overload because of bug 1020975 + // void setTransform(double a, double b, double c, double d, double e, double f); + + // No throw necessary here - SVGMatrix is always good. + void setTransform(SVGMatrix matrix); }; interface TextMetrics { From 5dc4c32f6022a1f0aa9835e26a41eee5fa19a443 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Mon, 9 Jun 2014 11:38:13 -0400 Subject: [PATCH 50/68] Bug 1022703 - fix unused variable warning in nsChromeRegistryChrome.cpp; r=bsmedberg --- chrome/src/nsChromeRegistryChrome.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/src/nsChromeRegistryChrome.cpp b/chrome/src/nsChromeRegistryChrome.cpp index ec7d3b977ad..c0337673fda 100644 --- a/chrome/src/nsChromeRegistryChrome.cpp +++ b/chrome/src/nsChromeRegistryChrome.cpp @@ -614,12 +614,12 @@ nsChromeRegistryChrome::kTableOps = { nsChromeRegistryChrome::ProviderEntry* nsChromeRegistryChrome::nsProviderArray::GetProvider(const nsACString& aPreferred, MatchType aType) { - int32_t i = mArray.Length(); + size_t i = mArray.Length(); if (!i) return nullptr; ProviderEntry* found = nullptr; // Only set if we find a partial-match locale - ProviderEntry* entry; + ProviderEntry* entry = nullptr; while (i--) { entry = &mArray[i]; From aef72e8fa33bbe2ca77829560335c948f2cc1bf2 Mon Sep 17 00:00:00 2001 From: Brian Hackett Date: Thu, 12 Jun 2014 14:13:49 -0600 Subject: [PATCH 51/68] Bug 1024678 - Avoid pushing/popping floating point registers in regexp jitcode, r=jandem. --- js/src/irregexp/NativeRegExpMacroAssembler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/src/irregexp/NativeRegExpMacroAssembler.cpp b/js/src/irregexp/NativeRegExpMacroAssembler.cpp index ffb6bf65201..498304e85e4 100644 --- a/js/src/irregexp/NativeRegExpMacroAssembler.cpp +++ b/js/src/irregexp/NativeRegExpMacroAssembler.cpp @@ -394,7 +394,7 @@ NativeRegExpMacroAssembler::GenerateCode(JSContext *cx) masm.movePtr(ImmPtr(runtime), temp1); // Save registers before calling C function - RegisterSet volatileRegs = RegisterSet::Volatile(); + GeneralRegisterSet volatileRegs = GeneralRegisterSet::Volatile(); #if defined(JS_CODEGEN_ARM) volatileRegs.add(Register::FromCode(Registers::lr)); #elif defined(JS_CODEGEN_MIPS) @@ -733,7 +733,7 @@ NativeRegExpMacroAssembler::CheckNotBackReferenceIgnoreCase(int start_reg, Label JS_ASSERT(mode_ == JSCHAR); // Note: temp1 needs to be saved/restored if it is volatile, as it is used after the call. - RegisterSet volatileRegs = RegisterSet::Volatile(); + GeneralRegisterSet volatileRegs = GeneralRegisterSet::Volatile(); volatileRegs.takeUnchecked(temp0); volatileRegs.takeUnchecked(temp2); masm.PushRegsInMask(volatileRegs); From e3e7209c970a9b61f294b8d2f99c656b4f949154 Mon Sep 17 00:00:00 2001 From: Randell Jesup Date: Thu, 12 Jun 2014 12:20:10 -0400 Subject: [PATCH 52/68] Bug 1024288: Allow aec debug data to be dumped on the fly, with max size r=pkerr --- build/gyp.mozbuild | 2 +- .../modules/audio_processing/aec/aec_core.c | 92 +++++++++++++++---- .../audio_processing/aec/aec_core_internal.h | 1 + .../audio_processing/aec/echo_cancellation.c | 79 ++++++++++++---- .../webrtc/system_wrappers/interface/trace.h | 14 +++ .../system_wrappers/source/trace_impl.cc | 8 ++ 6 files changed, 160 insertions(+), 36 deletions(-) diff --git a/build/gyp.mozbuild b/build/gyp.mozbuild index e9a6064564b..001cce6cd08 100644 --- a/build/gyp.mozbuild +++ b/build/gyp.mozbuild @@ -43,7 +43,7 @@ gyp_vars = { # (for vp8) chromium sets to 0 also 'use_temporal_layers': 0, # Creates AEC internal sample dump files in current directory - # 'aec_debug_dump': 1, + 'aec_debug_dump': 1, # codec enable/disables: 'include_g711': 1, diff --git a/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core.c b/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core.c index 7dda551f3d8..222dcb96b3f 100644 --- a/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core.c +++ b/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core.c @@ -28,6 +28,11 @@ #include "webrtc/system_wrappers/interface/cpu_features_wrapper.h" #include "webrtc/typedefs.h" +extern int AECDebug(); +extern uint32_t AECDebugMaxSize(); +extern void AECDebugEnable(uint32_t enable); +static void OpenCoreDebugFiles(AecCore* aec, int *instance_count); + // Buffer size (samples) static const size_t kBufSizePartitions = 250; // 1 second of audio in 16 kHz. @@ -211,17 +216,9 @@ int WebRtcAec_CreateAec(AecCore** aecInst) { aec = NULL; return -1; } - { - char filename[64]; - sprintf(filename, "aec_far%d.pcm", webrtc_aec_instance_count); - aec->farFile = fopen(filename, "wb"); - sprintf(filename, "aec_near%d.pcm", webrtc_aec_instance_count); - aec->nearFile = fopen(filename, "wb"); - sprintf(filename, "aec_out%d.pcm", webrtc_aec_instance_count); - aec->outFile = fopen(filename, "wb"); - sprintf(filename, "aec_out_linear%d.pcm", webrtc_aec_instance_count); - aec->outLinearFile = fopen(filename, "wb"); - } + aec->outLinearFile = aec->outFile = aec->nearFile = aec->farFile = NULL; + aec->debugWritten = 0; + OpenCoreDebugFiles(aec, &webrtc_aec_instance_count); #endif aec->delay_estimator_farend = WebRtc_CreateDelayEstimatorFarend(PART_LEN1, kHistorySizeBlocks); @@ -256,10 +253,13 @@ int WebRtcAec_FreeAec(AecCore* aec) { WebRtc_FreeBuffer(aec->far_buf_windowed); #ifdef WEBRTC_AEC_DEBUG_DUMP WebRtc_FreeBuffer(aec->far_time_buf); - fclose(aec->farFile); - fclose(aec->nearFile); - fclose(aec->outFile); - fclose(aec->outLinearFile); + if (aec->farFile) { + // we don't let one be open and not the others + fclose(aec->farFile); + fclose(aec->nearFile); + fclose(aec->outFile); + fclose(aec->outLinearFile); + } #endif WebRtc_FreeDelayEstimator(aec->delay_estimator); WebRtc_FreeDelayEstimatorFarend(aec->delay_estimator_farend); @@ -848,8 +848,15 @@ static void ProcessBlock(AecCore* aec) { int16_t farend[PART_LEN]; int16_t* farend_ptr = NULL; WebRtc_ReadBuffer(aec->far_time_buf, (void**)&farend_ptr, farend, 1); - (void)fwrite(farend_ptr, sizeof(int16_t), PART_LEN, aec->farFile); - (void)fwrite(nearend_ptr, sizeof(int16_t), PART_LEN, aec->nearFile); + OpenCoreDebugFiles(aec, &webrtc_aec_instance_count); + if (aec->farFile) { + (void)fwrite(farend_ptr, sizeof(int16_t), PART_LEN, aec->farFile); + (void)fwrite(nearend_ptr, sizeof(int16_t), PART_LEN, aec->nearFile); + aec->debugWritten += sizeof(int16_t) * PART_LEN; + if (aec->debugWritten >= AECDebugMaxSize()) { + AECDebugEnable(0); + } + } } #endif @@ -1006,8 +1013,11 @@ static void ProcessBlock(AecCore* aec) { WEBRTC_SPL_WORD16_MAX, e[i], WEBRTC_SPL_WORD16_MIN); } - (void)fwrite(eInt16, sizeof(int16_t), PART_LEN, aec->outLinearFile); - (void)fwrite(output, sizeof(int16_t), PART_LEN, aec->outFile); + OpenCoreDebugFiles(aec, &webrtc_aec_instance_count); + if (aec->outLinearFile) { + (void)fwrite(eInt16, sizeof(int16_t), PART_LEN, aec->outLinearFile); + (void)fwrite(output, sizeof(int16_t), PART_LEN, aec->outFile); + } } #endif } @@ -1711,3 +1721,47 @@ static void TimeToFrequency(float time_data[PART_LEN2], } } +#ifdef WEBRTC_AEC_DEBUG_DUMP +static void +OpenCoreDebugFiles(AecCore* aec, + int *instance_count) +{ + int error = 0; + // XXX If this impacts performance (opening files here), move file open + // to Trace::set_aec_debug(), and just grab them here + if (AECDebug() && !aec->farFile) { + char filename[128]; + if (!aec->farFile) { + sprintf(filename, "aec_far%d.pcm", webrtc_aec_instance_count); + aec->farFile = fopen(filename, "wb"); + sprintf(filename, "aec_near%d.pcm", webrtc_aec_instance_count); + aec->nearFile = fopen(filename, "wb"); + sprintf(filename, "aec_out%d.pcm", webrtc_aec_instance_count); + aec->outFile = fopen(filename, "wb"); + sprintf(filename, "aec_out_linear%d.pcm", webrtc_aec_instance_count); + aec->outLinearFile = fopen(filename, "wb"); + aec->debugWritten = 0; + if (!aec->outLinearFile || !aec->outFile || !aec->nearFile || !aec->farFile) { + error = 1; + } + } + } + if (error || + (!AECDebug() && aec->farFile)) { + if (aec->farFile) { + fclose(aec->farFile); + } + if (aec->nearFile) { + fclose(aec->nearFile); + } + if (aec->outFile) { + fclose(aec->outFile); + } + if (aec->outLinearFile) { + fclose(aec->outLinearFile); + } + aec->outLinearFile = aec->outFile = aec->nearFile = aec->farFile = NULL; + aec->debugWritten = 0; + } +} +#endif diff --git a/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core_internal.h b/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core_internal.h index 193369382ca..8655d47cd80 100644 --- a/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core_internal.h +++ b/media/webrtc/trunk/webrtc/modules/audio_processing/aec/aec_core_internal.h @@ -133,6 +133,7 @@ struct AecCore { FILE* nearFile; FILE* outFile; FILE* outLinearFile; + uint32_t debugWritten; #endif }; diff --git a/media/webrtc/trunk/webrtc/modules/audio_processing/aec/echo_cancellation.c b/media/webrtc/trunk/webrtc/modules/audio_processing/aec/echo_cancellation.c index bbdd5f628b2..3b99154315e 100644 --- a/media/webrtc/trunk/webrtc/modules/audio_processing/aec/echo_cancellation.c +++ b/media/webrtc/trunk/webrtc/modules/audio_processing/aec/echo_cancellation.c @@ -27,6 +27,11 @@ #include "webrtc/modules/audio_processing/utility/ring_buffer.h" #include "webrtc/typedefs.h" +extern int AECDebug(); +extern uint32_t AECDebugMaxSize(); +extern void AECDebugEnable(uint32_t enable); +static void OpenDebugFiles(aecpc_t* aecpc, int *instance_count); + // Measured delays [ms] // Device Chrome GTP // MacBook Air 10 @@ -165,16 +170,9 @@ int32_t WebRtcAec_Create(void** aecInst) { aecpc = NULL; return -1; } - { - char filename[64]; - sprintf(filename, "aec_buf%d.dat", webrtc_aec_instance_count); - aecpc->bufFile = fopen(filename, "wb"); - sprintf(filename, "aec_skew%d.dat", webrtc_aec_instance_count); - aecpc->skewFile = fopen(filename, "wb"); - sprintf(filename, "aec_delay%d.dat", webrtc_aec_instance_count); - aecpc->delayFile = fopen(filename, "wb"); - webrtc_aec_instance_count++; - } + aecpc->bufFile = aecpc->skewFile = aecpc->delayFile = NULL; + OpenDebugFiles(aecpc, &webrtc_aec_instance_count); + #endif return 0; @@ -191,9 +189,12 @@ int32_t WebRtcAec_Free(void* aecInst) { #ifdef WEBRTC_AEC_DEBUG_DUMP WebRtc_FreeBuffer(aecpc->far_pre_buf_s16); - fclose(aecpc->bufFile); - fclose(aecpc->skewFile); - fclose(aecpc->delayFile); + if (aecpc->bufFile) { + // we don't let one be open and not the others + fclose(aecpc->bufFile); + fclose(aecpc->skewFile); + fclose(aecpc->delayFile); + } #endif WebRtcAec_FreeAec(aecpc->aec); @@ -439,9 +440,12 @@ int32_t WebRtcAec_Process(void* aecInst, { int16_t far_buf_size_ms = (int16_t)(WebRtcAec_system_delay(aecpc->aec) / (sampMsNb * aecpc->rate_factor)); - (void)fwrite(&far_buf_size_ms, 2, 1, aecpc->bufFile); - (void)fwrite( + OpenDebugFiles(aecpc, &webrtc_aec_instance_count); + if (aecpc->bufFile) { + (void)fwrite(&far_buf_size_ms, 2, 1, aecpc->bufFile); + (void)fwrite( &aecpc->knownDelay, sizeof(aecpc->knownDelay), 1, aecpc->delayFile); + } } #endif @@ -678,7 +682,10 @@ static int ProcessNormal(aecpc_t* aecpc, } #ifdef WEBRTC_AEC_DEBUG_DUMP - (void)fwrite(&aecpc->skew, sizeof(aecpc->skew), 1, aecpc->skewFile); + OpenDebugFiles(aecpc, &webrtc_aec_instance_count); + if (aecpc->skewFile) { + (void)fwrite(&aecpc->skew, sizeof(aecpc->skew), 1, aecpc->skewFile); + } #endif } } @@ -968,3 +975,43 @@ static void EstBufDelayExtended(aecpc_t* self) { self->knownDelay = WEBRTC_SPL_MAX((int)self->filtDelay - 256, 0); } } + +#ifdef WEBRTC_AEC_DEBUG_DUMP +static void +OpenDebugFiles(aecpc_t* aecpc, + int *instance_count) +{ + int error = 0; + // XXX If this impacts performance (opening files here), move file open + // to Trace::set_aec_debug(), and just grab them here + if (AECDebug() && !aecpc->bufFile) { + char filename[128]; + sprintf(filename, "aec_buf%d.dat", *instance_count); + aecpc->bufFile = fopen(filename, "wb"); + sprintf(filename, "aec_skew%d.dat", *instance_count); + aecpc->skewFile = fopen(filename, "wb"); + sprintf(filename, "aec_delay%d.dat", *instance_count); + aecpc->delayFile = fopen(filename, "wb"); + + if (!aecpc->bufFile || !aecpc->skewFile || !aecpc->delayFile) { + error = 1; + } else { + (*instance_count)++; + } + } + if (error || + (!AECDebug() && aecpc->bufFile)) { + if (aecpc->bufFile) { + fclose(aecpc->bufFile); + } + if (aecpc->skewFile) { + fclose(aecpc->skewFile); + } + if (aecpc->delayFile) { + fclose(aecpc->delayFile); + } + aecpc->bufFile = aecpc->skewFile = aecpc->delayFile = NULL; + } +} + +#endif diff --git a/media/webrtc/trunk/webrtc/system_wrappers/interface/trace.h b/media/webrtc/trunk/webrtc/system_wrappers/interface/trace.h index 44ea658bdf2..9085680b537 100644 --- a/media/webrtc/trunk/webrtc/system_wrappers/interface/trace.h +++ b/media/webrtc/trunk/webrtc/system_wrappers/interface/trace.h @@ -54,6 +54,12 @@ class Trace { // Returns what type of messages are written to the trace file. static uint32_t level_filter() { return level_filter_; } + // Enable dumping of AEC inputs and outputs. Can be changed in mid-call + static void set_aec_debug(bool enable) { aec_debug_ = enable; } + static void set_aec_debug_size(uint32_t size) { aec_debug_size_ = size; } + static bool aec_debug() { return aec_debug_; } + static uint32_t aec_debug_size() { return aec_debug_size_; } + // Sets the file name. If add_file_counter is false the same file will be // reused when it fills up. If it's true a new file with incremented name // will be used. @@ -85,8 +91,16 @@ class Trace { private: static uint32_t level_filter_; + static bool aec_debug_; + static uint32_t aec_debug_size_; }; } // namespace webrtc +extern "C" { + extern int AECDebug(); + extern uint32_t AECDebugMaxSize(); + extern void AECDebugEnable(uint32_t enable); +} + #endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_TRACE_H_ diff --git a/media/webrtc/trunk/webrtc/system_wrappers/source/trace_impl.cc b/media/webrtc/trunk/webrtc/system_wrappers/source/trace_impl.cc index 73b5b29b056..f5b05ac4f5f 100644 --- a/media/webrtc/trunk/webrtc/system_wrappers/source/trace_impl.cc +++ b/media/webrtc/trunk/webrtc/system_wrappers/source/trace_impl.cc @@ -29,12 +29,20 @@ #pragma warning(disable:4355) #endif // _WIN32 +extern "C" { + int AECDebug() { return (int) webrtc::Trace::aec_debug(); } + uint32_t AECDebugMaxSize() { return webrtc::Trace::aec_debug_size(); } + void AECDebugEnable(uint32_t enable) { webrtc::Trace::set_aec_debug(!!enable); } +} + namespace webrtc { const int Trace::kBoilerplateLength = 71; const int Trace::kTimestampPosition = 13; const int Trace::kTimestampLength = 12; uint32_t Trace::level_filter_ = kTraceDefault; +bool Trace::aec_debug_ = false; +uint32_t Trace::aec_debug_size_ = 4*1024*1024; // Construct On First Use idiom. Avoids "static initialization order fiasco". TraceImpl* TraceImpl::StaticInstance(CountOperation count_operation, From 9d1bc6e5a6914a258a498561a7ac7e9866048cd3 Mon Sep 17 00:00:00 2001 From: Randell Jesup Date: Thu, 12 Jun 2014 12:21:38 -0400 Subject: [PATCH 53/68] Bug 1024288: Add a button to about:webrtc to turn on/off AEC logging r=jib,smaug,unfocused --- dom/webidl/WebrtcGlobalInformation.webidl | 3 +++ .../src/common/browser_logging/WebRtcLog.cpp | 15 +++++++++++ .../WebrtcGlobalInformation.cpp | 16 ++++++++++++ .../peerconnection/WebrtcGlobalInformation.h | 3 +++ modules/libpref/src/init/all.js | 1 + toolkit/content/aboutWebrtc.xhtml | 26 +++++++++++++++++++ 6 files changed, 64 insertions(+) diff --git a/dom/webidl/WebrtcGlobalInformation.webidl b/dom/webidl/WebrtcGlobalInformation.webidl index 0715a27df5a..70e021c59d5 100644 --- a/dom/webidl/WebrtcGlobalInformation.webidl +++ b/dom/webidl/WebrtcGlobalInformation.webidl @@ -29,6 +29,9 @@ interface WebrtcGlobalInformation { // - Subsequently setting a zero debug level writes that log to disk. static attribute long debugLevel; + + // WebRTC AEC debugging enable + static attribute boolean aecDebug; }; diff --git a/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp b/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp index 75d112a5df1..d702d9ad148 100644 --- a/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp +++ b/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp @@ -28,6 +28,15 @@ static PRLogModuleInfo* GetWebRtcTraceLog() return sLog; } +static PRLogModuleInfo* GetWebRtcAECLog() +{ + static PRLogModuleInfo *sLog; + if (!sLog) { + sLog = PR_NewLogModule("AEC"); + } + return sLog; +} + class WebRtcTraceCallback: public webrtc::TraceCallback { public: @@ -48,6 +57,7 @@ void GetWebRtcLogPrefs(uint32_t *aTraceMask, nsACString* aLogFile, bool *aMultiL *aMultiLog = mozilla::Preferences::GetBool("media.webrtc.debug.multi_log"); *aTraceMask = mozilla::Preferences::GetUint("media.webrtc.debug.trace_mask"); mozilla::Preferences::GetCString("media.webrtc.debug.log_file", aLogFile); + webrtc::Trace::set_aec_debug_size(mozilla::Preferences::GetUint("media.webrtc.debug.aec_dump_max_size")); } #endif @@ -70,6 +80,11 @@ void CheckOverrides(uint32_t *aTraceMask, nsACString *aLogFile, bool *aMultiLog) *aTraceMask = log_info->level; } + log_info = GetWebRtcAECLog(); + if (log_info && (log_info->level != 0)) { + webrtc::Trace::set_aec_debug(true); + } + const char *file_name = PR_GetEnv("WEBRTC_TRACE_FILE"); if (file_name) { aLogFile->Assign(file_name); diff --git a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp index 9ca9d04b0aa..089c95b657b 100644 --- a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp +++ b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp @@ -23,6 +23,7 @@ #include "runnable_utils.h" #include "PeerConnectionCtx.h" #include "PeerConnectionImpl.h" +#include "webrtc/system_wrappers/interface/trace.h" using sipcc::PeerConnectionImpl; using sipcc::PeerConnectionCtx; @@ -233,6 +234,7 @@ WebrtcGlobalInformation::GetLogging( } static int32_t sLastSetLevel = 0; +static bool sLastAECDebug = false; void WebrtcGlobalInformation::SetDebugLevel(const GlobalObject& aGlobal, int32_t aLevel) @@ -247,6 +249,20 @@ WebrtcGlobalInformation::DebugLevel(const GlobalObject& aGlobal) return sLastSetLevel; } +void +WebrtcGlobalInformation::SetAecDebug(const GlobalObject& aGlobal, bool aEnable) +{ + webrtc::Trace::set_aec_debug(aEnable); + sLastAECDebug = aEnable; +} + +bool +WebrtcGlobalInformation::AecDebug(const GlobalObject& aGlobal) +{ + return sLastAECDebug; +} + + struct StreamResult { StreamResult() : candidateTypeBitpattern(0), streamSucceeded(false) {} uint8_t candidateTypeBitpattern; diff --git a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.h b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.h index 906bac1f908..5e31c489683 100644 --- a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.h +++ b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.h @@ -36,6 +36,9 @@ public: static void SetDebugLevel(const GlobalObject& aGlobal, int32_t aLevel); static int32_t DebugLevel(const GlobalObject& aGlobal); + static void SetAecDebug(const GlobalObject& aGlobal, bool aEnable); + static bool AecDebug(const GlobalObject& aGlobal); + static void StoreLongTermICEStatistics(sipcc::PeerConnectionImpl& aPc); private: diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index 04c1a9e8542..15a45ab2ae1 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -265,6 +265,7 @@ pref("media.webrtc.debug.log_file", ""); #else pref("media.webrtc.debug.log_file", "/tmp/WebRTC.log"); #endif +pref("media.webrtc.debug.aec_dump_max_size", 4194304); // 4MB #ifdef MOZ_WIDGET_GONK pref("media.navigator.video.default_width",320); diff --git a/toolkit/content/aboutWebrtc.xhtml b/toolkit/content/aboutWebrtc.xhtml index ff23f6e1cd5..e60f75ef9fa 100644 --- a/toolkit/content/aboutWebrtc.xhtml +++ b/toolkit/content/aboutWebrtc.xhtml @@ -377,6 +377,11 @@ function onLoad() { } else { setDebugButton(false); } + if (WebrtcGlobalInformation.aecDebug) { + setAECDebugButton(true); + } else { + setAECDebugButton(false); + } } function startDebugMode() { @@ -395,6 +400,24 @@ function setDebugButton(on) { button.onclick = on ? stopDebugMode : startDebugMode; } +function startAECDebugMode() { + WebrtcGlobalInformation.aecDebug = true; + setAECDebugButton(true); +} + +function stopAECDebugMode() { + WebrtcGlobalInformation.aecDebug = false; + setAECDebugButton(false); +} + +function setAECDebugButton(on) { + var button = document.getElementById("aec-debug-toggle-button"); + button.innerHTML = on ? "Stop AEC logging" : "Start AEC logging"; + button.onclick = on ? stopAECDebugMode : startAECDebugMode; +} + + + @@ -406,6 +429,9 @@ function setDebugButton(on) { +
    From d48b100585e7438b7027b3b97ca9125c2e0e8927 Mon Sep 17 00:00:00 2001 From: Michael Daly Date: Thu, 12 Jun 2014 06:53:00 -0400 Subject: [PATCH 54/68] Bug 1015214 - Update PSL for .uk. r=gerv --- netwerk/dns/effective_tld_names.dat | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/netwerk/dns/effective_tld_names.dat b/netwerk/dns/effective_tld_names.dat index 6bcad0f5e87..3b6cba2a0d7 100644 --- a/netwerk/dns/effective_tld_names.dat +++ b/netwerk/dns/effective_tld_names.dat @@ -6168,19 +6168,19 @@ com.ug org.ug // uk : http://en.wikipedia.org/wiki/.uk -// Submitted by registry 2012-10-02 -// and tweaked by us pending further consultation. -*.uk +// Submitted by registry +uk +ac.uk +co.uk +gov.uk +ltd.uk +me.uk +net.uk +nhs.uk +org.uk +plc.uk +police.uk *.sch.uk -!bl.uk -!british-library.uk -!jet.uk -!mod.uk -!national-library-scotland.uk -!nel.uk -!nic.uk -!nls.uk -!parliament.uk // us : http://en.wikipedia.org/wiki/.us us From 424844467109f8f2dcf184a958c3edc36161df0c Mon Sep 17 00:00:00 2001 From: Gervase Markham Date: Thu, 12 Jun 2014 07:31:00 -0400 Subject: [PATCH 55/68] Bug 985495 - Add nfshost.com to PSL. r=gerv --- netwerk/dns/effective_tld_names.dat | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/netwerk/dns/effective_tld_names.dat b/netwerk/dns/effective_tld_names.dat index 3b6cba2a0d7..4f633e6594e 100644 --- a/netwerk/dns/effective_tld_names.dat +++ b/netwerk/dns/effective_tld_names.dat @@ -8192,14 +8192,18 @@ azurewebsites.net azure-mobile.net cloudapp.net -// One Fold Media : http://www.onefoldmedia.com/ -// Submitted by Eddie Jones 2014-06-10 -nid.io +// NFSN, Inc. : https://www.NearlyFreeSpeech.NET/ +// Submitted by Jeff Wheelhouse 2014-02-02 +nfshost.com // NYC.mn : http://www.information.nyc.mn // Submitted by Matthew Brown 2013-03-11 nyc.mn +// One Fold Media : http://www.onefoldmedia.com/ +// Submitted by Eddie Jones 2014-06-10 +nid.io + // Opera Software, A.S.A. // Submitted by Yngve Pettersen 2009-11-26 operaunite.com From c4d31af6384e547c89e913bdd80d29f019f51d76 Mon Sep 17 00:00:00 2001 From: Gervase Markham Date: Thu, 12 Jun 2014 07:38:00 -0400 Subject: [PATCH 56/68] Bug 981927 - Update public suffix list for .cm. r=gerv --- netwerk/dns/effective_tld_names.dat | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/netwerk/dns/effective_tld_names.dat b/netwerk/dns/effective_tld_names.dat index 4f633e6594e..a800bc75b65 100644 --- a/netwerk/dns/effective_tld_names.dat +++ b/netwerk/dns/effective_tld_names.dat @@ -598,9 +598,12 @@ gob.cl co.cl mil.cl -// cm : http://en.wikipedia.org/wiki/.cm +// cm : http://en.wikipedia.org/wiki/.cm plus bug 981927 cm +co.cm +com.cm gov.cm +net.cm // cn : http://en.wikipedia.org/wiki/.cn // Submitted by registry 2008-06-11 From bddd1d5e1f0cf0a5bd03b3d908025c739bda798c Mon Sep 17 00:00:00 2001 From: Gavin Brown Date: Wed, 11 Jun 2014 06:23:00 -0400 Subject: [PATCH 57/68] Bug 1006570 - Add com.se to the PSL. r=gerv --- netwerk/dns/effective_tld_names.dat | 1 + 1 file changed, 1 insertion(+) diff --git a/netwerk/dns/effective_tld_names.dat b/netwerk/dns/effective_tld_names.dat index a800bc75b65..c72767ebc70 100644 --- a/netwerk/dns/effective_tld_names.dat +++ b/netwerk/dns/effective_tld_names.dat @@ -7761,6 +7761,7 @@ ar.com br.com cn.com com.de +com.se de.com eu.com gb.com From 450b502b07f818c0d23713dcb508433154552787 Mon Sep 17 00:00:00 2001 From: Chris Raynor Date: Wed, 11 Jun 2014 06:21:00 -0400 Subject: [PATCH 58/68] Bug 962360 - Add firebaseapp.com to the PSL. r=gerv --- netwerk/dns/effective_tld_names.dat | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/netwerk/dns/effective_tld_names.dat b/netwerk/dns/effective_tld_names.dat index c72767ebc70..20f84e9888b 100644 --- a/netwerk/dns/effective_tld_names.dat +++ b/netwerk/dns/effective_tld_names.dat @@ -8117,6 +8117,10 @@ global.ssl.fastly.net a.prod.fastly.net global.prod.fastly.net +// Firebase, Inc. +// Submitted by Chris Raynor 2014-01-21 +firebaseapp.com + // GitHub, Inc. // Submitted by Ben Toews 2014-02-06 github.io From 6c0eb2f5550029fcc333249a65c8f487f229bf13 Mon Sep 17 00:00:00 2001 From: Gervase Markham Date: Thu, 12 Jun 2014 07:56:00 -0400 Subject: [PATCH 59/68] Bug 1024514 - Add more new gTLD PSL entries. r=gerv --- netwerk/dns/effective_tld_names.dat | 295 +++++++++++++++++++++++++++- 1 file changed, 294 insertions(+), 1 deletion(-) diff --git a/netwerk/dns/effective_tld_names.dat b/netwerk/dns/effective_tld_names.dat index 20f84e9888b..fd84dc6f663 100644 --- a/netwerk/dns/effective_tld_names.dat +++ b/netwerk/dns/effective_tld_names.dat @@ -7691,9 +7691,302 @@ hiv // sca : 2014-03-13 SVENSKA CELLULOSA AKTIEBOLAGET SCA (publ) sca -// reise : 2014-03-13 dotreise GmbH +// reise : 2014-03-13 dotreise GmbH reise +// accountants : 2014-03-20 Knob Town, LLC +accountants + +// clinic : 2014-03-20 Goose Park, LLC +clinic + +// versicherung : 2014-03-20 dotversicherung-registry GmbH +versicherung + +// top : 2014-03-20 Jiangsu Bangning Science & Technology Co.,Ltd. +top + +// furniture : 2014-03-20 Lone Fields, LLC +furniture + +// dental : 2014-03-20 Tin Birch, LLC +dental + +// fund : 2014-03-20 John Castle, LLC +fund + +// creditcard : 2014-03-20 Binky Frostbite, LLC +creditcard + +// insure : 2014-03-20 Pioneer Willow, LLC +insure + +// audio : 2014-03-20 Uniregistry, Corp. +audio + +// claims : 2014-03-20 Black Corner, LLC +claims + +// loans : 2014-03-20 June Woods, LLC +loans + +// auction : 2014-03-20 Sand Galley, LLC +auction + +// attorney : 2014-03-20 Victor North, LLC +attorney + +// finance : 2014-03-20 Cotton Cypress, LLC +finance + +// investments : 2014-03-20 Holly Glen, LLC +investments + +// juegos : 2014-03-20 Uniregistry, Corp. +juegos + +// dentist : 2014-03-20 Outer Lake, LLC +dentist + +// lds : 2014-03-20 IRI Domain Management, LLC +lds + +// lawyer : 2014-03-20 Atomic Station, LLC +lawyer + +// surgery : 2014-03-20 Tin Avenue, LLC +surgery + +// gratis : 2014-03-20 Pioneer Tigers, LLC +gratis + +// software : 2014-03-20 Over Birch, LLC +software + +// mortgage : 2014-03-20 Outer Gardens, LLC +mortgage + +// republican : 2014-03-20 United TLD Holdco Ltd. +republican + +// credit : 2014-03-20 Snow Shadow, LLC +credit + +// tax : 2014-03-20 Storm Orchard, LLC +tax + +// africa : 2014-03-24 ZA Central Registry NPC trading as Registry.Africa +africa + +// joburg : 2014-03-24 ZA Central Registry NPC trading as ZA Central Registry +joburg + +// durban : 2014-03-24 ZA Central Registry NPC trading as ZA Central Registry +durban + +// capetown : 2014-03-24 ZA Central Registry NPC trading as ZA Central Registry +capetown + +// sap : 2014-03-27 SAP AG +sap + +// datsun : 2014-03-27 NISSAN MOTOR CO., LTD. +datsun + +// infiniti : 2014-03-27 NISSAN MOTOR CO., LTD. +infiniti + +// firmdale : 2014-03-27 Firmdale Holdings Limited +firmdale + +// organic : 2014-03-27 Afilias Limited +organic + +// nissan : 2014-03-27 NISSAN MOTOR CO., LTD. +nissan + +// website : 2014-04-03 DotWebsite Inc. +website + +// space : 2014-04-03 DotSpace Inc. +space + +// schmidt : 2014-04-03 SALM S.A.S. +schmidt + +// cuisinella : 2014-04-03 SALM S.A.S. +cuisinella + +// samsung : 2014-04-03 SAMSUNG SDS CO., LTD +samsung + +// crs : 2014-04-03 Federated Co operatives Limited +crs + +// doosan : 2014-04-03 Doosan Corporation +doosan + +// press : 2014-04-03 DotPress Inc. +press + +// emerck : 2014-04-03 Merck KGaA +emerck + +// erni : 2014-04-03 ERNI Group Holding AG +erni + +// direct : 2014-04-10 Half Trail, LLC +direct + +// yandex : 2014-04-10 YANDEX, LLC +yandex + +// lotto : 2014-04-10 Afilias Limited +lotto + +// toshiba : 2014-04-10 TOSHIBA Corporation +toshiba + +// bauhaus : 2014-04-17 Werkhaus GmbH +bauhaus + +// host : 2014-04-17 DotHost Inc. +host + +// ltda : 2014-04-17 DOMAIN ROBOT SERVICOS DE HOSPEDAGEM NA INTERNET LTDA +ltda + +// global : 2014-04-17 Dot GLOBAL AS +global + +// abogado : 2014-04-24 Top Level Domain Holdings Limited +abogado + +// place : 2014-04-24 Snow Galley, LLC +place + +// tirol : 2014-04-24 punkt Tirol GmbH +tirol + +// gmx : 2014-04-24 1&1 Mail & Media GmbH +gmx + +// tatar : 2014-04-24 Limited Liability Company "Coordination Center of Regional Domain of Tatarstan Republic" +tatar + +// scholarships : 2014-04-24 Scholarships.com, LLC +scholarships + +// eurovision : 2014-04-24 European Broadcasting Union (EBU) +eurovision + +// wedding : 2014-04-24 Top Level Domain Holdings Limited +wedding + +// active : 2014-05-01 The Active Network, Inc +active + +// madrid : 2014-05-01 Comunidad de Madrid +madrid + +// youtube : 2014-05-01 Charleston Road Registry Inc. +youtube + +// sharp : 2014-05-01 Sharp Corporation +sharp + +// uol : 2014-05-01 UBN INTERNET LTDA. +uol + +// physio : 2014-05-01 PhysBiz Pty Ltd +physio + +// gmail : 2014-05-01 Charleston Road Registry Inc. +gmail + +// channel : 2014-05-08 Charleston Road Registry Inc. +channel + +// fly : 2014-05-08 Charleston Road Registry Inc. +fly + +// zip : 2014-05-08 Charleston Road Registry Inc. +zip + +// esq : 2014-05-08 Charleston Road Registry Inc. +esq + +// rsvp : 2014-05-08 Charleston Road Registry Inc. +rsvp + +// wales : 2014-05-08 Nominet UK +wales + +// cymru : 2014-05-08 Nominet UK +cymru + +// green : 2014-05-08 Afilias Limited +green + +// lgbt : 2014-05-08 Afilias Limited +lgbt + +// xn--hxt814e : 2014-05-15 Zodiac Libra Limited +网店 + +// cancerresearch : 2014-05-15 Australian Cancer Research Foundation +cancerresearch + +// everbank : 2014-05-15 EverBank +everbank + +// frl : 2014-05-15 FRLregistry B.V. +frl + +// property : 2014-05-22 Uniregistry, Corp. +property + +// forsale : 2014-05-22 Sea Oaks, LLC +forsale + +// seat : 2014-05-22 SEAT, S.A. (Sociedad Unipersonal) +seat + +// deals : 2014-05-22 Sand Sunset, LLC +deals + +// nra : 2014-05-22 NRA Holdings Company, INC. +nra + +// xn--fjq720a : 2014-05-22 Will Bloom, LLC +娱乐 + +// realtor : 2014-05-29 Real Estate Domains LLC +realtor + +// bnpparibas : 2014-05-29 BNP Paribas +bnpparibas + +// melbourne : 2014-05-29 The Crown in right of the State of Victoria, represented by its Department of State Development, Business and Innovation +melbourne + +// hosting : 2014-05-29 Uniregistry, Corp. +hosting + +// yoga : 2014-05-29 Top Level Domain Holdings Limited +yoga + +// city : 2014-05-29 Snow Sky, LLC +city + +// bond : 2014-06-05 Bond University Limited +bond + +// click : 2014-06-05 Uniregistry, Corp. +click + +// cern : 2014-06-05 European Organization for Nuclear Research ("CERN") +cern // ===END ICANN DOMAINS=== // ===BEGIN PRIVATE DOMAINS=== From 62e49a9e51403bb9ce4478926c146fdd03d65e0c Mon Sep 17 00:00:00 2001 From: "Nils Ohlmeier [:drno]" Date: Thu, 12 Jun 2014 11:48:00 -0400 Subject: [PATCH 60/68] Bug 1010641 - Record the ICE connection state transitions. r=bwc --- dom/media/tests/mochitest/pc.js | 15 +++++++++ dom/media/tests/mochitest/templates.js | 43 ++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/dom/media/tests/mochitest/pc.js b/dom/media/tests/mochitest/pc.js index f4e64508149..78bf5281970 100644 --- a/dom/media/tests/mochitest/pc.js +++ b/dom/media/tests/mochitest/pc.js @@ -1708,6 +1708,21 @@ PeerConnectionWrapper.prototype = { return (this.isIceChecking() || this.isIceNew()); }, + /** + * Registers a callback for the ICE connection state change and + * appends the new state to an array for logging it later. + */ + logIceConnectionState: function PCW_logIceConnectionState() { + var self = this; + + function logIceConState () { + self.iceConnectionLog.push(self._pc.iceConnectionState); + } + + self.iceConnectionLog = [self._pc.iceConnectionState]; + self.ice_connection_callbacks.logIceStatus = logIceConState; + }, + /** * Registers a callback for the ICE connection state change and * reports success (=connected) or failure via the callbacks. diff --git a/dom/media/tests/mochitest/templates.js b/dom/media/tests/mochitest/templates.js index a35bfd6aefb..1d4d5105329 100644 --- a/dom/media/tests/mochitest/templates.js +++ b/dom/media/tests/mochitest/templates.js @@ -19,6 +19,13 @@ function dumpSdp(test) { dump("ERROR: SDP answer: " + test._remote_answer.sdp.replace(/[\r]/g, '')); } + if (typeof test.pcLocal.iceConnectionLog !== 'undefined') { + dump("pcLocal ICE connection state log: " + test.pcLocal.iceConnectionLog + "\n"); + } + if (typeof test.pcRemote.iceConnectionLog !== 'undefined') { + dump("pcRemote ICE connection state log: " + test.pcRemote.iceConnectionLog + "\n"); + } + if ((typeof test.pcLocal.setRemoteDescDate !== 'undefined') && (typeof test.pcRemote.setLocalDescDate !== 'undefined')) { var delta = deltaSeconds(test.pcLocal.setRemoteDescDate, test.pcRemote.setLocalDescDate); @@ -69,6 +76,20 @@ var commandsPeerConnection = [ test.next(); } ], + [ + 'PC_LOCAL_SETUP_ICE_LOGGER', + function (test) { + test.pcLocal.logIceConnectionState(); + test.next(); + } + ], + [ + 'PC_REMOTE_SETUP_ICE_LOGGER', + function (test) { + test.pcRemote.logIceConnectionState(); + test.next(); + } + ], [ 'PC_LOCAL_CREATE_OFFER', function (test) { @@ -178,6 +199,7 @@ var commandsPeerConnection = [ var myPc = myTest.pcLocal; function onIceConnectedSuccess () { + info("pcLocal ICE connection state log: " + test.pcLocal.iceConnectionLog); ok(true, "pc_local: ICE switched to 'connected' state"); myTest.next(); }; @@ -188,6 +210,7 @@ var commandsPeerConnection = [ }; if (myPc.isIceConnected()) { + info("pcLocal ICE connection state log: " + test.pcLocal.iceConnectionLog); ok(true, "pc_local: ICE is in connected state"); myTest.next(); } else if (myPc.isIceConnectionPending()) { @@ -206,6 +229,7 @@ var commandsPeerConnection = [ var myPc = myTest.pcRemote; function onIceConnectedSuccess () { + info("pcRemote ICE connection state log: " + test.pcRemote.iceConnectionLog); ok(true, "pc_remote: ICE switched to 'connected' state"); myTest.next(); }; @@ -216,6 +240,7 @@ var commandsPeerConnection = [ }; if (myPc.isIceConnected()) { + info("pcRemote ICE connection state log: " + test.pcRemote.iceConnectionLog); ok(true, "pc_remote: ICE is in connected state"); myTest.next(); } else if (myPc.isIceConnectionPending()) { @@ -300,6 +325,13 @@ var commandsDataChannel = [ test.next(); } ], + [ + 'PC_LOCAL_SETUP_ICE_LOGGER', + function (test) { + test.pcLocal.logIceConnectionState(); + test.next(); + } + ], [ 'PC_REMOTE_GUM', function (test) { @@ -316,6 +348,13 @@ var commandsDataChannel = [ test.next(); } ], + [ + 'PC_REMOTE_SETUP_ICE_LOGGER', + function (test) { + test.pcRemote.logIceConnectionState(); + test.next(); + } + ], [ 'PC_LOCAL_CREATE_DATA_CHANNEL', function (test) { @@ -428,6 +467,7 @@ var commandsDataChannel = [ var myPc = myTest.pcLocal; function onIceConnectedSuccess () { + info("pcLocal ICE connection state log: " + test.pcLocal.iceConnectionLog); ok(true, "pc_local: ICE switched to 'connected' state"); myTest.next(); }; @@ -438,6 +478,7 @@ var commandsDataChannel = [ }; if (myPc.isIceConnected()) { + info("pcLocal ICE connection state log: " + test.pcLocal.iceConnectionLog); ok(true, "pc_local: ICE is in connected state"); myTest.next(); } else if (myPc.isIceConnectionPending()) { @@ -456,6 +497,7 @@ var commandsDataChannel = [ var myPc = myTest.pcRemote; function onIceConnectedSuccess () { + info("pcRemote ICE connection state log: " + test.pcRemote.iceConnectionLog); ok(true, "pc_remote: ICE switched to 'connected' state"); myTest.next(); }; @@ -466,6 +508,7 @@ var commandsDataChannel = [ }; if (myPc.isIceConnected()) { + info("pcRemote ICE connection state log: " + test.pcRemote.iceConnectionLog); ok(true, "pc_remote: ICE is in connected state"); myTest.next(); } else if (myPc.isIceConnectionPending()) { From fffcf0f0c7db2ab551457e020edc8099ca65106d Mon Sep 17 00:00:00 2001 From: "Nils Ohlmeier [:drno]" Date: Thu, 12 Jun 2014 13:31:00 -0400 Subject: [PATCH 61/68] Bug 1010641 - Verify if ICE state transition is legit. r=bwc --- dom/media/tests/mochitest/pc.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/dom/media/tests/mochitest/pc.js b/dom/media/tests/mochitest/pc.js index 78bf5281970..e12063c76df 100644 --- a/dom/media/tests/mochitest/pc.js +++ b/dom/media/tests/mochitest/pc.js @@ -5,6 +5,19 @@ "use strict"; +const iceStateTransitions = { + "new": ["checking", "closed"], //Note: 'failed' might need to added here + // even though it is not in the standard + "checking": ["new", "connected", "failed", "closed"], //Note: do we need to + // allow 'completed' in + // here as well? + "connected": ["new", "completed", "disconnected", "closed"], + "completed": ["new", "disconnected", "closed"], + "disconnected": ["new", "connected", "completed", "failed", "closed"], + "failed": ["new", "disconnected", "closed"], + "closed": [] + } + /** * This class mimics a state machine and handles a list of commands by * executing them synchronously. @@ -1716,6 +1729,13 @@ PeerConnectionWrapper.prototype = { var self = this; function logIceConState () { + var newstate = self._pc.iceConnectionState; + var oldstate = self.iceConnectionLog[self.iceConnectionLog.length - 1] + if (Object.keys(iceStateTransitions).indexOf(oldstate) != -1) { + ok(iceStateTransitions[oldstate].indexOf(newstate) != -1, "Legal ICE state transition from " + oldstate + " to " + newstate); + } else { + ok(false, "Old ICE state " + oldstate + " missing in ICE transition array"); + } self.iceConnectionLog.push(self._pc.iceConnectionState); } From 301d17203d7e73c035b3395f696debbf7cedd519 Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Fri, 6 Jun 2014 15:43:00 -0400 Subject: [PATCH 62/68] Bug 1019310 - Remove comment about x86 in ARM-specific code. r=shu --- js/src/jit/arm/LIR-arm.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/js/src/jit/arm/LIR-arm.h b/js/src/jit/arm/LIR-arm.h index bc1c4808be1..0296282506e 100644 --- a/js/src/jit/arm/LIR-arm.h +++ b/js/src/jit/arm/LIR-arm.h @@ -431,8 +431,6 @@ class LUMod : public LBinaryMath<0> } }; -// This class performs a simple x86 'div', yielding either a quotient or remainder depending on -// whether this instruction is defined to output eax (quotient) or edx (remainder). class LSoftUDivOrMod : public LBinaryMath<3> { public: From 28582f6a62a4a5272bb60823fe0ae73b139aac4d Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Thu, 12 Jun 2014 10:39:00 -0400 Subject: [PATCH 63/68] Bug 1019310 - Make bailout kinds more precise. r=shu --- js/src/jit/BaselineBailouts.cpp | 38 ++++- js/src/jit/IonBuilder.cpp | 3 +- js/src/jit/IonTypes.h | 161 ++++++++++++++++++++-- js/src/jit/LIR.h | 2 +- js/src/jit/Lowering.cpp | 93 +++++++------ js/src/jit/MIR.h | 43 +++++- js/src/jit/Snapshots.cpp | 2 +- js/src/jit/arm/Lowering-arm.cpp | 26 ++-- js/src/jit/mips/Lowering-mips.cpp | 18 +-- js/src/jit/shared/Lowering-shared.cpp | 4 +- js/src/jit/shared/Lowering-shared.h | 5 +- js/src/jit/shared/Lowering-x86-shared.cpp | 20 +-- 12 files changed, 317 insertions(+), 98 deletions(-) diff --git a/js/src/jit/BaselineBailouts.cpp b/js/src/jit/BaselineBailouts.cpp index 2e4cc7e2389..1afc24e7a79 100644 --- a/js/src/jit/BaselineBailouts.cpp +++ b/js/src/jit/BaselineBailouts.cpp @@ -1672,13 +1672,45 @@ jit::FinishBailoutToBaseline(BaselineBailoutInfo *bailoutInfo) (unsigned) bailoutKind); switch (bailoutKind) { - case Bailout_Normal: + // Normal bailouts. + case Bailout_Inevitable: + case Bailout_DuringVMCall: + case Bailout_NonJSFunctionCallee: + case Bailout_DynamicNameNotFound: + case Bailout_StringArgumentsEval: + case Bailout_Overflow: + case Bailout_Round: + case Bailout_NonPrimitiveInput: + case Bailout_PrecisionLoss: + case Bailout_TypeBarrierO: + case Bailout_TypeBarrierV: + case Bailout_MonitorTypes: + case Bailout_Hole: + case Bailout_NegativeIndex: + case Bailout_ObjectIdentityOrTypeGuard: + case Bailout_NonInt32Input: + case Bailout_NonNumericInput: + case Bailout_NonBooleanInput: + case Bailout_NonObjectInput: + case Bailout_NonStringInput: + case Bailout_GuardThreadExclusive: + case Bailout_InitialState: // Do nothing. break; + + // Invalid assumption based on baseline code. + case Bailout_OverflowInvalidate: + case Bailout_NonStringInputInvalidate: + case Bailout_DoubleOutput: + if (!HandleBaselineInfoBailout(cx, outerScript, innerScript)) + return false; + break; + case Bailout_ArgumentCheck: // Do nothing, bailout will resume before the argument monitor ICs. break; case Bailout_BoundsCheck: + case Bailout_Neutered: if (!HandleBoundsCheckFailure(cx, outerScript, innerScript)) return false; break; @@ -1686,10 +1718,6 @@ jit::FinishBailoutToBaseline(BaselineBailoutInfo *bailoutInfo) if (!HandleShapeGuardFailure(cx, outerScript, innerScript)) return false; break; - case Bailout_BaselineInfo: - if (!HandleBaselineInfoBailout(cx, outerScript, innerScript)) - return false; - break; case Bailout_IonExceptionDebugMode: // Return false to resume in HandleException with reconstructed // baseline frame. diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp index fe45c436bba..f4951c5f719 100644 --- a/js/src/jit/IonBuilder.cpp +++ b/js/src/jit/IonBuilder.cpp @@ -9899,7 +9899,8 @@ IonBuilder::jsop_iternext() return false; if (!nonStringIteration_ && !inspector->hasSeenNonStringIterNext(pc)) { - ins = MUnbox::New(alloc(), ins, MIRType_String, MUnbox::Fallible, Bailout_BaselineInfo); + ins = MUnbox::New(alloc(), ins, MIRType_String, MUnbox::Fallible, + Bailout_NonStringInputInvalidate); current->add(ins); current->rewriteAtDepth(-1, ins); } diff --git a/js/src/jit/IonTypes.h b/js/src/jit/IonTypes.h index ea462c2cf7d..f22a8597cec 100644 --- a/js/src/jit/IonTypes.h +++ b/js/src/jit/IonTypes.h @@ -35,9 +35,96 @@ static const SnapshotOffset INVALID_SNAPSHOT_OFFSET = uint32_t(-1); // the bits reserved for bailout kinds in Bailouts.h enum BailoutKind { - // A normal bailout triggered from type, shape, and assorted overflow - // guards in the compiler. - Bailout_Normal, + // Normal bailouts, that don't need to be handled specially when restarting + // in baseline. + + // An inevitable bailout (MBail instruction or type barrier that always bails) + Bailout_Inevitable, + + // Bailing out during a VM call. Many possible causes that are hard + // to distinguish statically at snapshot construction time. + // We just lump them together. + Bailout_DuringVMCall, + + // Call to a non-JSFunction (problem for |apply|) + Bailout_NonJSFunctionCallee, + + // Dynamic scope chain lookup produced |undefined| + Bailout_DynamicNameNotFound, + + // Input string contains 'arguments' or 'eval' + Bailout_StringArgumentsEval, + + // Bailout on overflow, but don't immediately invalidate. + // Used for abs, sub and LoadTypedArrayElement (when loading a uint32 that + // doesn't fit in an int32). + Bailout_Overflow, + + // floor, ceiling and round bail if input is NaN, if output would be -0 or + // doesn't fit in int32 range + Bailout_Round, + + // Non-primitive value used as input for ToDouble, ToInt32, ToString, etc. + // For ToInt32, can also mean that input can't be converted without precision + // loss (e.g. 5.5). + Bailout_NonPrimitiveInput, + + // For ToInt32, would lose precision when converting (e.g. 5.5). + Bailout_PrecisionLoss, + + // We tripped a type barrier (object was not in the expected TypeSet) + Bailout_TypeBarrierO, + // We tripped a type barrier (value was not in the expected TypeSet) + Bailout_TypeBarrierV, + // We tripped a type monitor (wrote an unexpected type in a property) + Bailout_MonitorTypes, + + // We hit a hole in an array. + Bailout_Hole, + + // Array access with negative index + Bailout_NegativeIndex, + + // Pretty specific case: + // - need a type barrier on a property write + // - all but one of the observed types have property types that reflect the value + // - we need to guard that we're not given an object of that one other type + // also used for the unused GuardClass instruction + Bailout_ObjectIdentityOrTypeGuard, + + // Unbox expects a given type, bails out if it doesn't get it. + Bailout_NonInt32Input, + Bailout_NonNumericInput, // unboxing a double works with int32 too + Bailout_NonBooleanInput, + Bailout_NonObjectInput, + Bailout_NonStringInput, + + Bailout_GuardThreadExclusive, + + // For the initial snapshot when entering a function. + Bailout_InitialState, + + // END Normal bailouts + + + // Bailouts caused by invalid assumptions based on Baseline code. + // Causes immediate invalidation. + + // Like Bailout_Overflow, but causes immediate invalidation. + Bailout_OverflowInvalidate, + + // Like NonStringInput, but should cause immediate invalidation. + // Used for jsop_iternext. + Bailout_NonStringInputInvalidate, + + // Used for integer division, multiplication and modulo. + // If there's a remainder, bails to return a double. + // Can also signal overflow or result of -0. + // Can also signal division by 0 (returns inf, a double). + Bailout_DoubleOutput, + + // END Invalid assumptions bailouts + // A bailout at the very start of a function indicates that there may be // a type mismatch in the arguments that necessitates a reflow. @@ -45,13 +132,14 @@ enum BailoutKind // A bailout triggered by a bounds-check failure. Bailout_BoundsCheck, + // A bailout triggered by a neutered typed object. + Bailout_Neutered, // A shape guard based on TI information failed. + // (We saw an object whose shape does not match that / any of those observed + // by the baseline IC.) Bailout_ShapeGuard, - // A bailout caused by invalid assumptions based on Baseline code. - Bailout_BaselineInfo, - // A bailout to baseline from Ion on exception to handle Debugger hooks. Bailout_IonExceptionDebugMode, }; @@ -60,16 +148,69 @@ inline const char * BailoutKindString(BailoutKind kind) { switch (kind) { - case Bailout_Normal: - return "Bailout_Normal"; + // Normal bailouts. + case Bailout_Inevitable: + return "Bailout_Inevitable"; + case Bailout_DuringVMCall: + return "Bailout_DuringVMCall"; + case Bailout_NonJSFunctionCallee: + return "Bailout_NonJSFunctionCallee"; + case Bailout_DynamicNameNotFound: + return "Bailout_DynamicNameNotFound"; + case Bailout_StringArgumentsEval: + return "Bailout_StringArgumentsEval"; + case Bailout_Overflow: + return "Bailout_Overflow"; + case Bailout_Round: + return "Bailout_Round"; + case Bailout_NonPrimitiveInput: + return "Bailout_NonPrimitiveInput"; + case Bailout_PrecisionLoss: + return "Bailout_PrecisionLoss"; + case Bailout_TypeBarrierO: + return "Bailout_TypeBarrierO"; + case Bailout_TypeBarrierV: + return "Bailout_TypeBarrierV"; + case Bailout_MonitorTypes: + return "Bailout_MonitorTypes"; + case Bailout_Hole: + return "Bailout_Hole"; + case Bailout_NegativeIndex: + return "Bailout_NegativeIndex"; + case Bailout_ObjectIdentityOrTypeGuard: + return "Bailout_ObjectIdentityOrTypeGuard"; + case Bailout_NonInt32Input: + return "Bailout_NonInt32Input"; + case Bailout_NonNumericInput: + return "Bailout_NonNumericInput"; + case Bailout_NonBooleanInput: + return "Bailout_NonBooleanInput"; + case Bailout_NonObjectInput: + return "Bailout_NonObjectInput"; + case Bailout_NonStringInput: + return "Bailout_NonStringInput"; + case Bailout_GuardThreadExclusive: + return "Bailout_GuardThreadExclusive"; + case Bailout_InitialState: + return "Bailout_InitialState"; + + // Bailouts caused by invalid assumptions. + case Bailout_OverflowInvalidate: + return "Bailout_OverflowInvalidate"; + case Bailout_NonStringInputInvalidate: + return "Bailout_NonStringInputInvalidate"; + case Bailout_DoubleOutput: + return "Bailout_DoubleOutput"; + + // Other bailouts. case Bailout_ArgumentCheck: return "Bailout_ArgumentCheck"; case Bailout_BoundsCheck: return "Bailout_BoundsCheck"; + case Bailout_Neutered: + return "Bailout_Neutered"; case Bailout_ShapeGuard: return "Bailout_ShapeGuard"; - case Bailout_BaselineInfo: - return "Bailout_BaselineInfo"; case Bailout_IonExceptionDebugMode: return "Bailout_IonExceptionDebugMode"; default: diff --git a/js/src/jit/LIR.h b/js/src/jit/LIR.h index 1ed8e2d8cdd..54cc1ab2727 100644 --- a/js/src/jit/LIR.h +++ b/js/src/jit/LIR.h @@ -1570,7 +1570,7 @@ class LIRGraph } void setEntrySnapshot(LSnapshot *snapshot) { JS_ASSERT(!entrySnapshot_); - JS_ASSERT(snapshot->bailoutKind() == Bailout_Normal); + JS_ASSERT(snapshot->bailoutKind() == Bailout_InitialState); snapshot->setBailoutKind(Bailout_ArgumentCheck); entrySnapshot_ = snapshot; } diff --git a/js/src/jit/Lowering.cpp b/js/src/jit/Lowering.cpp index 2bc0c278e79..69fe8d58ea2 100644 --- a/js/src/jit/Lowering.cpp +++ b/js/src/jit/Lowering.cpp @@ -494,7 +494,7 @@ LIRGenerator::visitApplyArgs(MApplyArgs *apply) return false; // Bailout is only needed in the case of possible non-JSFunction callee. - if (!apply->getSingleTarget() && !assignSnapshot(lir)) + if (!apply->getSingleTarget() && !assignSnapshot(lir, Bailout_NonJSFunctionCallee)) return false; if (!defineReturn(lir, apply)) @@ -508,7 +508,7 @@ bool LIRGenerator::visitBail(MBail *bail) { LBail *lir = new(alloc()) LBail(); - return assignSnapshot(lir) && add(lir, bail); + return assignSnapshot(lir, bail->bailoutKind()) && add(lir, bail); } bool @@ -551,7 +551,7 @@ LIRGenerator::visitGetDynamicName(MGetDynamicName *ins) tempFixed(CallTempReg3), tempFixed(CallTempReg4)); - return assignSnapshot(lir) && defineReturn(lir, ins); + return assignSnapshot(lir, Bailout_DynamicNameNotFound) && defineReturn(lir, ins); } bool @@ -576,7 +576,9 @@ LIRGenerator::visitFilterArgumentsOrEval(MFilterArgumentsOrEval *ins) } } - return assignSnapshot(lir) && add(lir, ins) && assignSafepoint(lir, ins); + return assignSnapshot(lir, Bailout_StringArgumentsEval) + && add(lir, ins) + && assignSafepoint(lir, ins); } bool @@ -1126,7 +1128,7 @@ LIRGenerator::lowerShiftOp(JSOp op, MShiftInstruction *ins) LShiftI *lir = new(alloc()) LShiftI(op); if (op == JSOP_URSH) { - if (ins->toUrsh()->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (ins->toUrsh()->fallible() && !assignSnapshot(lir, Bailout_OverflowInvalidate)) return false; } return lowerForShift(lir, ins, lhs, rhs); @@ -1173,13 +1175,13 @@ LIRGenerator::visitFloor(MFloor *ins) if (type == MIRType_Double) { LFloor *lir = new(alloc()) LFloor(useRegister(ins->num())); - if (!assignSnapshot(lir)) + if (!assignSnapshot(lir, Bailout_Round)) return false; return define(lir, ins); } LFloorF *lir = new(alloc()) LFloorF(useRegister(ins->num())); - if (!assignSnapshot(lir)) + if (!assignSnapshot(lir, Bailout_Round)) return false; return define(lir, ins); } @@ -1192,13 +1194,13 @@ LIRGenerator::visitCeil(MCeil *ins) if (type == MIRType_Double) { LCeil *lir = new(alloc()) LCeil(useRegister(ins->num())); - if (!assignSnapshot(lir)) + if (!assignSnapshot(lir, Bailout_Round)) return false; return define(lir, ins); } LCeilF *lir = new(alloc()) LCeilF(useRegister(ins->num())); - if (!assignSnapshot(lir)) + if (!assignSnapshot(lir, Bailout_Round)) return false; return define(lir, ins); } @@ -1211,13 +1213,13 @@ LIRGenerator::visitRound(MRound *ins) if (type == MIRType_Double) { LRound *lir = new (alloc()) LRound(useRegister(ins->num()), tempDouble()); - if (!assignSnapshot(lir)) + if (!assignSnapshot(lir, Bailout_Round)) return false; return define(lir, ins); } LRoundF *lir = new (alloc()) LRoundF(useRegister(ins->num()), tempDouble()); - if (!assignSnapshot(lir)) + if (!assignSnapshot(lir, Bailout_Round)) return false; return define(lir, ins); } @@ -1248,7 +1250,7 @@ LIRGenerator::visitAbs(MAbs *ins) if (num->type() == MIRType_Int32) { LAbsI *lir = new(alloc()) LAbsI(useRegisterAtStart(num)); // needed to handle abs(INT32_MIN) - if (ins->fallible() && !assignSnapshot(lir)) + if (ins->fallible() && !assignSnapshot(lir, Bailout_Overflow)) return false; return defineReuseInput(lir, ins, 0); } @@ -1393,7 +1395,7 @@ LIRGenerator::visitAdd(MAdd *ins) ReorderCommutative(&lhs, &rhs); LAddI *lir = new(alloc()) LAddI; - if (ins->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (ins->fallible() && !assignSnapshot(lir, Bailout_OverflowInvalidate)) return false; if (!lowerForALU(lir, ins, lhs, rhs)) @@ -1430,7 +1432,7 @@ LIRGenerator::visitSub(MSub *ins) JS_ASSERT(lhs->type() == MIRType_Int32); LSubI *lir = new(alloc()) LSubI; - if (ins->fallible() && !assignSnapshot(lir)) + if (ins->fallible() && !assignSnapshot(lir, Bailout_Overflow)) return false; if (!lowerForALU(lir, ins, lhs, rhs)) @@ -1638,7 +1640,7 @@ LIRGenerator::visitStart(MStart *start) { // Create a snapshot that captures the initial state of the function. LStart *lir = new(alloc()) LStart; - if (!assignSnapshot(lir)) + if (!assignSnapshot(lir, Bailout_InitialState)) return false; if (start->startType() == MStart::StartType_Default) @@ -1705,7 +1707,7 @@ LIRGenerator::visitToDouble(MToDouble *convert) LValueToDouble *lir = new(alloc()) LValueToDouble(); if (!useBox(lir, LValueToDouble::Input, opd)) return false; - return assignSnapshot(lir) && define(lir, convert); + return assignSnapshot(lir, Bailout_NonPrimitiveInput) && define(lir, convert); } case MIRType_Null: @@ -1754,7 +1756,7 @@ LIRGenerator::visitToFloat32(MToFloat32 *convert) LValueToFloat32 *lir = new(alloc()) LValueToFloat32(); if (!useBox(lir, LValueToFloat32::Input, opd)) return false; - return assignSnapshot(lir) && define(lir, convert); + return assignSnapshot(lir, Bailout_NonPrimitiveInput) && define(lir, convert); } case MIRType_Null: @@ -1800,10 +1802,13 @@ LIRGenerator::visitToInt32(MToInt32 *convert) switch (opd->type()) { case MIRType_Value: { - LValueToInt32 *lir = new(alloc()) LValueToInt32(tempDouble(), temp(), LValueToInt32::NORMAL); + LValueToInt32 *lir = + new(alloc()) LValueToInt32(tempDouble(), temp(), LValueToInt32::NORMAL); if (!useBox(lir, LValueToInt32::Input, opd)) return false; - return assignSnapshot(lir) && define(lir, convert) && assignSafepoint(lir, convert); + return assignSnapshot(lir, Bailout_NonPrimitiveInput) + && define(lir, convert) + && assignSafepoint(lir, convert); } case MIRType_Null: @@ -1816,13 +1821,13 @@ LIRGenerator::visitToInt32(MToInt32 *convert) case MIRType_Float32: { LFloat32ToInt32 *lir = new(alloc()) LFloat32ToInt32(useRegister(opd)); - return assignSnapshot(lir) && define(lir, convert); + return assignSnapshot(lir, Bailout_PrecisionLoss) && define(lir, convert); } case MIRType_Double: { LDoubleToInt32 *lir = new(alloc()) LDoubleToInt32(useRegister(opd)); - return assignSnapshot(lir) && define(lir, convert); + return assignSnapshot(lir, Bailout_PrecisionLoss) && define(lir, convert); } case MIRType_String: @@ -1845,10 +1850,13 @@ LIRGenerator::visitTruncateToInt32(MTruncateToInt32 *truncate) switch (opd->type()) { case MIRType_Value: { - LValueToInt32 *lir = new(alloc()) LValueToInt32(tempDouble(), temp(), LValueToInt32::TRUNCATE); + LValueToInt32 *lir = new(alloc()) LValueToInt32(tempDouble(), temp(), + LValueToInt32::TRUNCATE); if (!useBox(lir, LValueToInt32::Input, opd)) return false; - return assignSnapshot(lir) && define(lir, truncate) && assignSafepoint(lir, truncate); + return assignSnapshot(lir, Bailout_NonPrimitiveInput) + && define(lir, truncate) + && assignSafepoint(lir, truncate); } case MIRType_Null: @@ -1918,7 +1926,7 @@ LIRGenerator::visitToString(MToString *ins) LValueToString *lir = new(alloc()) LValueToString(tempToUnbox()); if (!useBox(lir, LValueToString::Input, opd)) return false; - if (ins->fallible() && !assignSnapshot(lir)) + if (ins->fallible() && !assignSnapshot(lir, Bailout_NonPrimitiveInput)) return false; if (!define(lir, ins)) return false; @@ -2272,7 +2280,7 @@ LIRGenerator::visitTypeBarrier(MTypeBarrier *ins) // (Emit LBail for visibility). if (ins->alwaysBails()) { LBail *bail = new(alloc()) LBail(); - if (!assignSnapshot(bail)) + if (!assignSnapshot(bail, Bailout_Inevitable)) return false; return redefine(ins, ins->input()) && add(bail, ins); } @@ -2283,7 +2291,7 @@ LIRGenerator::visitTypeBarrier(MTypeBarrier *ins) LTypeBarrierV *barrier = new(alloc()) LTypeBarrierV(tmp); if (!useBox(barrier, LTypeBarrierV::Input, ins->input())) return false; - if (!assignSnapshot(barrier)) + if (!assignSnapshot(barrier, Bailout_TypeBarrierV)) return false; return redefine(ins, ins->input()) && add(barrier, ins); } @@ -2294,7 +2302,7 @@ LIRGenerator::visitTypeBarrier(MTypeBarrier *ins) { LDefinition tmp = needTemp ? temp() : LDefinition::BogusTemp(); LTypeBarrierO *barrier = new(alloc()) LTypeBarrierO(useRegister(ins->getOperand(0)), tmp); - if (!assignSnapshot(barrier)) + if (!assignSnapshot(barrier, Bailout_TypeBarrierO)) return false; return redefine(ins, ins->getOperand(0)) && add(barrier, ins); } @@ -2316,7 +2324,7 @@ LIRGenerator::visitMonitorTypes(MMonitorTypes *ins) LMonitorTypes *lir = new(alloc()) LMonitorTypes(tmp); if (!useBox(lir, LMonitorTypes::Input, ins->input())) return false; - return assignSnapshot(lir, Bailout_Normal) && add(lir, ins); + return assignSnapshot(lir, Bailout_MonitorTypes) && add(lir, ins); } bool @@ -2488,7 +2496,7 @@ LIRGenerator::visitNeuterCheck(MNeuterCheck *ins) { LNeuterCheck *chk = new(alloc()) LNeuterCheck(useRegister(ins->object()), temp()); - if (!assignSnapshot(chk, Bailout_BoundsCheck)) + if (!assignSnapshot(chk, Bailout_Neutered)) return false; return redefine(ins, ins->input()) && add(chk, ins); } @@ -2551,7 +2559,7 @@ LIRGenerator::visitLoadElement(MLoadElement *ins) { LLoadElementV *lir = new(alloc()) LLoadElementV(useRegister(ins->elements()), useRegisterOrConstant(ins->index())); - if (ins->fallible() && !assignSnapshot(lir)) + if (ins->fallible() && !assignSnapshot(lir, Bailout_Hole)) return false; return defineBox(lir, ins); } @@ -2563,7 +2571,7 @@ LIRGenerator::visitLoadElement(MLoadElement *ins) { LLoadElementT *lir = new(alloc()) LLoadElementT(useRegister(ins->elements()), useRegisterOrConstant(ins->index())); - if (ins->fallible() && !assignSnapshot(lir)) + if (ins->fallible() && !assignSnapshot(lir, Bailout_Hole)) return false; return define(lir, ins); } @@ -2581,7 +2589,7 @@ LIRGenerator::visitLoadElementHole(MLoadElementHole *ins) LLoadElementHole *lir = new(alloc()) LLoadElementHole(useRegister(ins->elements()), useRegisterOrConstant(ins->index()), useRegister(ins->initLength())); - if (ins->needsNegativeIntCheck() && !assignSnapshot(lir)) + if (ins->needsNegativeIntCheck() && !assignSnapshot(lir, Bailout_NegativeIndex)) return false; return defineBox(lir, ins); } @@ -2599,7 +2607,7 @@ LIRGenerator::visitStoreElement(MStoreElement *ins) case MIRType_Value: { LInstruction *lir = new(alloc()) LStoreElementV(elements, index); - if (ins->fallible() && !assignSnapshot(lir)) + if (ins->fallible() && !assignSnapshot(lir, Bailout_Hole)) return false; if (!useBox(lir, LStoreElementV::Value, ins->value())) return false; @@ -2610,7 +2618,7 @@ LIRGenerator::visitStoreElement(MStoreElement *ins) { const LAllocation value = useRegisterOrNonDoubleConstant(ins->value()); LInstruction *lir = new(alloc()) LStoreElementT(elements, index, value); - if (ins->fallible() && !assignSnapshot(lir)) + if (ins->fallible() && !assignSnapshot(lir, Bailout_Hole)) return false; return add(lir, ins); } @@ -2743,7 +2751,7 @@ LIRGenerator::visitLoadTypedArrayElement(MLoadTypedArrayElement *ins) tempDef = temp(); LLoadTypedArrayElement *lir = new(alloc()) LLoadTypedArrayElement(elements, index, tempDef); - if (ins->fallible() && !assignSnapshot(lir)) + if (ins->fallible() && !assignSnapshot(lir, Bailout_Overflow)) return false; return define(lir, ins); } @@ -2768,7 +2776,9 @@ LIRGenerator::visitClampToUint8(MClampToUint8 *ins) LClampVToUint8 *lir = new(alloc()) LClampVToUint8(tempDouble()); if (!useBox(lir, LClampVToUint8::Input, in)) return false; - return assignSnapshot(lir) && define(lir, ins) && assignSafepoint(lir, ins); + return assignSnapshot(lir, Bailout_NonPrimitiveInput) + && define(lir, ins) + && assignSafepoint(lir, ins); } default: @@ -2788,7 +2798,7 @@ LIRGenerator::visitLoadTypedArrayElementHole(MLoadTypedArrayElementHole *ins) const LAllocation index = useRegisterOrConstant(ins->index()); LLoadTypedArrayElementHole *lir = new(alloc()) LLoadTypedArrayElementHole(object, index); - if (ins->fallible() && !assignSnapshot(lir)) + if (ins->fallible() && !assignSnapshot(lir, Bailout_Overflow)) return false; return defineBox(lir, ins) && assignSafepoint(lir, ins); } @@ -2799,7 +2809,8 @@ LIRGenerator::visitLoadTypedArrayElementStatic(MLoadTypedArrayElementStatic *ins LLoadTypedArrayElementStatic *lir = new(alloc()) LLoadTypedArrayElementStatic(useRegisterAtStart(ins->ptr())); - if (ins->fallible() && !assignSnapshot(lir)) + // In case of out of bounds, may bail out, or may jump to ool code. + if (ins->fallible() && !assignSnapshot(lir, Bailout_BoundsCheck)) return false; return define(lir, ins); } @@ -3010,7 +3021,9 @@ bool LIRGenerator::visitGuardObjectIdentity(MGuardObjectIdentity *ins) { LGuardObjectIdentity *guard = new(alloc()) LGuardObjectIdentity(useRegister(ins->obj())); - return assignSnapshot(guard) && add(guard, ins) && redefine(ins, ins->obj()); + return assignSnapshot(guard, Bailout_ObjectIdentityOrTypeGuard) + && add(guard, ins) + && redefine(ins, ins->obj()); } bool @@ -3018,7 +3031,7 @@ LIRGenerator::visitGuardClass(MGuardClass *ins) { LDefinition t = temp(); LGuardClass *guard = new(alloc()) LGuardClass(useRegister(ins->obj()), t); - return assignSnapshot(guard) && add(guard, ins); + return assignSnapshot(guard, Bailout_ObjectIdentityOrTypeGuard) && add(guard, ins); } bool diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index e12286ec466..b9fa2651574 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -2279,22 +2279,34 @@ class MApplyArgs class MBail : public MNullaryInstruction { protected: - MBail() + MBail(BailoutKind kind) { + bailoutKind_ = kind; setGuard(); } + private: + BailoutKind bailoutKind_; + public: INSTRUCTION_HEADER(Bail) + static MBail * + New(TempAllocator &alloc, BailoutKind kind) { + return new(alloc) MBail(kind); + } static MBail * New(TempAllocator &alloc) { - return new(alloc) MBail(); + return new(alloc) MBail(Bailout_Inevitable); } AliasSet getAliasSet() const { return AliasSet::None(); } + + BailoutKind bailoutKind() const { + return bailoutKind_; + } }; class MAssertFloat32 : public MUnaryInstruction @@ -2693,7 +2705,30 @@ class MUnbox : public MUnaryInstruction, public BoxInputsPolicy INSTRUCTION_HEADER(Unbox) static MUnbox *New(TempAllocator &alloc, MDefinition *ins, MIRType type, Mode mode) { - return new(alloc) MUnbox(ins, type, mode, Bailout_Normal); + // Unless we were given a specific BailoutKind, pick a default based on + // the type we expect. + BailoutKind kind; + switch(type){ + case MIRType_Boolean: + kind = Bailout_NonBooleanInput; + break; + case MIRType_Int32: + kind = Bailout_NonInt32Input; + break; + case MIRType_Double: + kind = Bailout_NonNumericInput; // Int32s are fine too + break; + case MIRType_String: + kind = Bailout_NonStringInput; + break; + case MIRType_Object: + kind = Bailout_NonObjectInput; + break; + default: + MOZ_ASSUME_UNREACHABLE("Given MIRType cannot be unboxed."); + } + + return new(alloc) MUnbox(ins, type, mode, kind); } static MUnbox *New(TempAllocator &alloc, MDefinition *ins, MIRType type, Mode mode, @@ -9444,7 +9479,7 @@ class MGuardThreadExclusive return getOperand(1); } BailoutKind bailoutKind() const { - return Bailout_Normal; + return Bailout_GuardThreadExclusive; } bool congruentTo(const MDefinition *ins) const { return congruentIfOperandsEqual(ins); diff --git a/js/src/jit/Snapshots.cpp b/js/src/jit/Snapshots.cpp index a45b232551f..115e43905a5 100644 --- a/js/src/jit/Snapshots.cpp +++ b/js/src/jit/Snapshots.cpp @@ -482,7 +482,7 @@ SnapshotReader::SnapshotReader(const uint8_t *snapshots, uint32_t offset, // Details of snapshot header packing. static const uint32_t SNAPSHOT_BAILOUTKIND_SHIFT = 0; -static const uint32_t SNAPSHOT_BAILOUTKIND_BITS = 3; +static const uint32_t SNAPSHOT_BAILOUTKIND_BITS = 5; static const uint32_t SNAPSHOT_BAILOUTKIND_MASK = COMPUTE_MASK_(SNAPSHOT_BAILOUTKIND); static const uint32_t SNAPSHOT_ROFFSET_SHIFT = COMPUTE_SHIFT_AFTER_(SNAPSHOT_BAILOUTKIND); diff --git a/js/src/jit/arm/Lowering-arm.cpp b/js/src/jit/arm/Lowering-arm.cpp index c306e5f763c..462d152ed2c 100644 --- a/js/src/jit/arm/Lowering-arm.cpp +++ b/js/src/jit/arm/Lowering-arm.cpp @@ -277,7 +277,7 @@ LIRGeneratorARM::lowerDivI(MDiv *div) int32_t shift = FloorLog2(rhs); if (rhs > 0 && 1 << shift == rhs) { LDivPowTwoI *lir = new(alloc()) LDivPowTwoI(useRegisterAtStart(div->lhs()), shift); - if (div->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (div->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return define(lir, div); } @@ -285,14 +285,14 @@ LIRGeneratorARM::lowerDivI(MDiv *div) if (hasIDIV()) { LDivI *lir = new(alloc()) LDivI(useRegister(div->lhs()), useRegister(div->rhs()), temp()); - if (div->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (div->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return define(lir, div); } LSoftDivI *lir = new(alloc()) LSoftDivI(useFixedAtStart(div->lhs(), r0), useFixedAtStart(div->rhs(), r1), tempFixed(r1), tempFixed(r2), tempFixed(r3)); - if (div->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (div->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return defineFixed(lir, div, LAllocation(AnyRegister(r0))); } @@ -301,7 +301,7 @@ bool LIRGeneratorARM::lowerMulI(MMul *mul, MDefinition *lhs, MDefinition *rhs) { LMulI *lir = new(alloc()) LMulI; - if (mul->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (mul->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return lowerForALU(lir, mul, lhs, rhs); } @@ -317,12 +317,12 @@ LIRGeneratorARM::lowerModI(MMod *mod) int32_t shift = FloorLog2(rhs); if (rhs > 0 && 1 << shift == rhs) { LModPowTwoI *lir = new(alloc()) LModPowTwoI(useRegister(mod->lhs()), shift); - if (mod->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (mod->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return define(lir, mod); } else if (shift < 31 && (1 << (shift+1)) - 1 == rhs) { LModMaskI *lir = new(alloc()) LModMaskI(useRegister(mod->lhs()), temp(LDefinition::GENERAL), shift+1); - if (mod->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (mod->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return define(lir, mod); } @@ -330,7 +330,7 @@ LIRGeneratorARM::lowerModI(MMod *mod) if (hasIDIV()) { LModI *lir = new(alloc()) LModI(useRegister(mod->lhs()), useRegister(mod->rhs()), temp()); - if (mod->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (mod->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return define(lir, mod); } @@ -338,7 +338,7 @@ LIRGeneratorARM::lowerModI(MMod *mod) LSoftModI *lir = new(alloc()) LSoftModI(useFixedAtStart(mod->lhs(), r0), useFixedAtStart(mod->rhs(), r1), tempFixed(r0), tempFixed(r2), tempFixed(r3), temp(LDefinition::GENERAL)); - if (mod->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (mod->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return defineFixed(lir, mod, LAllocation(AnyRegister(r1))); } @@ -386,7 +386,7 @@ LIRGeneratorARM::visitGuardObjectType(MGuardObjectType *ins) LDefinition tempObj = temp(LDefinition::OBJECT); LGuardObjectType *guard = new(alloc()) LGuardObjectType(useRegister(ins->obj()), tempObj); - if (!assignSnapshot(guard)) + if (!assignSnapshot(guard, Bailout_ObjectIdentityOrTypeGuard)) return false; if (!add(guard, ins)) return false; @@ -429,13 +429,13 @@ LIRGeneratorARM::lowerUDiv(MDiv *div) LUDiv *lir = new(alloc()) LUDiv; lir->setOperand(0, useRegister(lhs)); lir->setOperand(1, useRegister(rhs)); - if (div->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (div->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return define(lir, div); } else { LSoftUDivOrMod *lir = new(alloc()) LSoftUDivOrMod(useFixedAtStart(lhs, r0), useFixedAtStart(rhs, r1), tempFixed(r1), tempFixed(r2), tempFixed(r3)); - if (div->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (div->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return defineFixed(lir, div, LAllocation(AnyRegister(r0))); } @@ -451,13 +451,13 @@ LIRGeneratorARM::lowerUMod(MMod *mod) LUMod *lir = new(alloc()) LUMod; lir->setOperand(0, useRegister(lhs)); lir->setOperand(1, useRegister(rhs)); - if (mod->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (mod->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return define(lir, mod); } else { LSoftUDivOrMod *lir = new(alloc()) LSoftUDivOrMod(useFixedAtStart(lhs, r0), useFixedAtStart(rhs, r1), tempFixed(r0), tempFixed(r2), tempFixed(r3)); - if (mod->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (mod->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return defineFixed(lir, mod, LAllocation(AnyRegister(r1))); } diff --git a/js/src/jit/mips/Lowering-mips.cpp b/js/src/jit/mips/Lowering-mips.cpp index 6f84a5fcd1f..370236be224 100644 --- a/js/src/jit/mips/Lowering-mips.cpp +++ b/js/src/jit/mips/Lowering-mips.cpp @@ -284,14 +284,14 @@ LIRGeneratorMIPS::lowerDivI(MDiv *div) int32_t shift = FloorLog2(rhs); if (rhs > 0 && 1 << shift == rhs) { LDivPowTwoI *lir = new(alloc()) LDivPowTwoI(useRegister(div->lhs()), shift, temp()); - if (div->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (div->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return define(lir, div); } } LDivI *lir = new(alloc()) LDivI(useRegister(div->lhs()), useRegister(div->rhs()), temp()); - if (div->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (div->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return define(lir, div); } @@ -300,7 +300,7 @@ bool LIRGeneratorMIPS::lowerMulI(MMul *mul, MDefinition *lhs, MDefinition *rhs) { LMulI *lir = new(alloc()) LMulI; - if (mul->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (mul->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return lowerForALU(lir, mul, lhs, rhs); @@ -317,13 +317,13 @@ LIRGeneratorMIPS::lowerModI(MMod *mod) int32_t shift = FloorLog2(rhs); if (rhs > 0 && 1 << shift == rhs) { LModPowTwoI *lir = new(alloc()) LModPowTwoI(useRegister(mod->lhs()), shift); - if (mod->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (mod->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return define(lir, mod); } else if (shift < 31 && (1 << (shift + 1)) - 1 == rhs) { LModMaskI *lir = new(alloc()) LModMaskI(useRegister(mod->lhs()), temp(LDefinition::GENERAL), shift + 1); - if (mod->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (mod->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return define(lir, mod); } @@ -331,7 +331,7 @@ LIRGeneratorMIPS::lowerModI(MMod *mod) LModI *lir = new(alloc()) LModI(useRegister(mod->lhs()), useRegister(mod->rhs()), temp(LDefinition::GENERAL)); - if (mod->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (mod->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return define(lir, mod); } @@ -379,7 +379,7 @@ LIRGeneratorMIPS::visitGuardObjectType(MGuardObjectType *ins) LDefinition tempObj = temp(LDefinition::OBJECT); LGuardObjectType *guard = new(alloc()) LGuardObjectType(useRegister(ins->obj()), tempObj); - if (!assignSnapshot(guard)) + if (!assignSnapshot(guard, Bailout_ObjectIdentityOrTypeGuard)) return false; if (!add(guard, ins)) return false; @@ -421,7 +421,7 @@ LIRGeneratorMIPS::lowerUDiv(MDiv *div) LUDiv *lir = new(alloc()) LUDiv; lir->setOperand(0, useRegister(lhs)); lir->setOperand(1, useRegister(rhs)); - if (div->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (div->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return define(lir, div); @@ -436,7 +436,7 @@ LIRGeneratorMIPS::lowerUMod(MMod *mod) LUMod *lir = new(alloc()) LUMod; lir->setOperand(0, useRegister(lhs)); lir->setOperand(1, useRegister(rhs)); - if (mod->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (mod->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return define(lir, mod); diff --git a/js/src/jit/shared/Lowering-shared.cpp b/js/src/jit/shared/Lowering-shared.cpp index cfb6c33c15f..b4ed2e7dad6 100644 --- a/js/src/jit/shared/Lowering-shared.cpp +++ b/js/src/jit/shared/Lowering-shared.cpp @@ -214,7 +214,7 @@ LIRGeneratorShared::assignSnapshot(LInstruction *ins, BailoutKind kind) } bool -LIRGeneratorShared::assignSafepoint(LInstruction *ins, MInstruction *mir) +LIRGeneratorShared::assignSafepoint(LInstruction *ins, MInstruction *mir, BailoutKind kind) { JS_ASSERT(!osiPoint_); JS_ASSERT(!ins->safepoint()); @@ -222,7 +222,7 @@ LIRGeneratorShared::assignSafepoint(LInstruction *ins, MInstruction *mir) ins->initSafepoint(alloc()); MResumePoint *mrp = mir->resumePoint() ? mir->resumePoint() : lastResumePoint_; - LSnapshot *postSnapshot = buildSnapshot(ins, mrp, Bailout_Normal); + LSnapshot *postSnapshot = buildSnapshot(ins, mrp, kind); if (!postSnapshot) return false; diff --git a/js/src/jit/shared/Lowering-shared.h b/js/src/jit/shared/Lowering-shared.h index 1ea1b64090f..10cd5d7c015 100644 --- a/js/src/jit/shared/Lowering-shared.h +++ b/js/src/jit/shared/Lowering-shared.h @@ -171,12 +171,13 @@ class LIRGeneratorShared : public MInstructionVisitorWithDefaults // effects (if any), it may check pre-conditions and bailout if they do not // hold. This function informs the register allocator that it will need to // capture appropriate state. - bool assignSnapshot(LInstruction *ins, BailoutKind kind = Bailout_Normal); + bool assignSnapshot(LInstruction *ins, BailoutKind kind); // Marks this instruction as needing to call into either the VM or GC. This // function may build a snapshot that captures the result of its own // instruction, and as such, should generally be called after define*(). - bool assignSafepoint(LInstruction *ins, MInstruction *mir); + bool assignSafepoint(LInstruction *ins, MInstruction *mir, + BailoutKind kind = Bailout_DuringVMCall); public: bool visitConstant(MConstant *ins); diff --git a/js/src/jit/shared/Lowering-x86-shared.cpp b/js/src/jit/shared/Lowering-x86-shared.cpp index 14f12b772e8..9c8da894014 100644 --- a/js/src/jit/shared/Lowering-x86-shared.cpp +++ b/js/src/jit/shared/Lowering-x86-shared.cpp @@ -50,7 +50,7 @@ LIRGeneratorX86Shared::visitGuardObjectType(MGuardObjectType *ins) JS_ASSERT(ins->obj()->type() == MIRType_Object); LGuardObjectType *guard = new(alloc()) LGuardObjectType(useRegisterAtStart(ins->obj())); - if (!assignSnapshot(guard)) + if (!assignSnapshot(guard, Bailout_ObjectIdentityOrTypeGuard)) return false; if (!add(guard, ins)) return false; @@ -122,7 +122,7 @@ LIRGeneratorX86Shared::lowerMulI(MMul *mul, MDefinition *lhs, MDefinition *rhs) // Note: lhs is used twice, so that we can restore the original value for the // negative zero check. LMulI *lir = new(alloc()) LMulI(useRegisterAtStart(lhs), useOrConstant(rhs), use(lhs)); - if (mul->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (mul->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return defineReuseInput(lir, mul, 0); } @@ -152,13 +152,13 @@ LIRGeneratorX86Shared::lowerDivI(MDiv *div) // lhs copy register is needed. lir = new(alloc()) LDivPowTwoI(lhs, useRegister(div->lhs()), shift, rhs < 0); } - if (div->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (div->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return defineReuseInput(lir, div, 0); } else if (rhs != 0) { LDivOrModConstantI *lir; lir = new(alloc()) LDivOrModConstantI(useRegister(div->lhs()), rhs, tempFixed(eax)); - if (div->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (div->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return defineFixed(lir, div, LAllocation(AnyRegister(edx))); } @@ -166,7 +166,7 @@ LIRGeneratorX86Shared::lowerDivI(MDiv *div) LDivI *lir = new(alloc()) LDivI(useRegister(div->lhs()), useRegister(div->rhs()), tempFixed(edx)); - if (div->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (div->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return defineFixed(lir, div, LAllocation(AnyRegister(eax))); } @@ -182,13 +182,13 @@ LIRGeneratorX86Shared::lowerModI(MMod *mod) int32_t shift = FloorLog2(Abs(rhs)); if (rhs != 0 && uint32_t(1) << shift == Abs(rhs)) { LModPowTwoI *lir = new(alloc()) LModPowTwoI(useRegisterAtStart(mod->lhs()), shift); - if (mod->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (mod->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return defineReuseInput(lir, mod, 0); } else if (rhs != 0) { LDivOrModConstantI *lir; lir = new(alloc()) LDivOrModConstantI(useRegister(mod->lhs()), rhs, tempFixed(edx)); - if (mod->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (mod->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return defineFixed(lir, mod, LAllocation(AnyRegister(eax))); } @@ -197,7 +197,7 @@ LIRGeneratorX86Shared::lowerModI(MMod *mod) LModI *lir = new(alloc()) LModI(useRegister(mod->lhs()), useRegister(mod->rhs()), tempFixed(eax)); - if (mod->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (mod->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return defineFixed(lir, mod, LAllocation(AnyRegister(edx))); } @@ -221,7 +221,7 @@ LIRGeneratorX86Shared::lowerUDiv(MDiv *div) LUDivOrMod *lir = new(alloc()) LUDivOrMod(useRegister(div->lhs()), useRegister(div->rhs()), tempFixed(edx)); - if (div->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (div->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return defineFixed(lir, div, LAllocation(AnyRegister(eax))); } @@ -232,7 +232,7 @@ LIRGeneratorX86Shared::lowerUMod(MMod *mod) LUDivOrMod *lir = new(alloc()) LUDivOrMod(useRegister(mod->lhs()), useRegister(mod->rhs()), tempFixed(eax)); - if (mod->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo)) + if (mod->fallible() && !assignSnapshot(lir, Bailout_DoubleOutput)) return false; return defineFixed(lir, mod, LAllocation(AnyRegister(edx))); } From 2b66f8beffdea2fd1a4598703d5a0cdd990cd869 Mon Sep 17 00:00:00 2001 From: Chris Manchester Date: Thu, 12 Jun 2014 13:53:23 -0400 Subject: [PATCH 64/68] Bug 1021931 - Add a fallback in mozlog.structured.commandline for users of optparse. r=jgraham --- .../mozlog/mozlog/structured/commandline.py | 38 +++++++++++++------ .../mozbase/mozlog/tests/test_structured.py | 11 +++++- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/testing/mozbase/mozlog/mozlog/structured/commandline.py b/testing/mozbase/mozlog/mozlog/structured/commandline.py index 72ab2c03ae7..61847e51597 100644 --- a/testing/mozbase/mozlog/mozlog/structured/commandline.py +++ b/testing/mozbase/mozlog/mozlog/structured/commandline.py @@ -4,6 +4,7 @@ import argparse import sys +import optparse from structuredlog import StructuredLogger, set_default_logger import handlers @@ -29,23 +30,36 @@ def log_file(name): def add_logging_group(parser): """ - Add logging options to an argparse ArgumentParser. + Add logging options to an argparse ArgumentParser or + optparse OptionParser. Each formatter has a corresponding option of the form --log-{name} where {name} is the name of the formatter. The option takes a value which is either a filename or "-" to indicate stdout. - :param parser: The ArgumentParser object that should have logging - options added. + :param parser: The ArgumentParser or OptionParser object that should have + logging options added. """ - group = parser.add_argument_group("Output Logging", - description="Options for logging output.\n" - "Each option represents a possible logging format " - "and takes a filename to write that format to, " - "or '-' to write to stdout.") - for name, (cls, help_str) in log_formatters.iteritems(): - group.add_argument("--log-" + name, action="append", type=log_file, - help=help_str) + group_name = "Output Logging" + group_description = ("Each option represents a possible logging format " + "and takes a filename to write that format to, " + "or '-' to write to stdout.") + + if isinstance(parser, optparse.OptionParser): + group = optparse.OptionGroup(parser, + group_name, + group_description) + for name, (cls, help_str) in log_formatters.iteritems(): + group.add_option("--log-" + name, action="append", type="str", + help=help_str) + + parser.add_option_group(group) + else: + group = parser.add_argument_group(group_name, + group_description) + for name, (cls, help_str) in log_formatters.iteritems(): + group.add_argument("--log-" + name, action="append", type=log_file, + help=help_str) def setup_logging(suite, args, defaults): @@ -73,6 +87,8 @@ def setup_logging(suite, args, defaults): if name.startswith(prefix) and values is not None: for value in values: found = True + if isinstance(value, str): + value = log_file(value) if value == sys.stdout: found_stdout_logger = True formatter_cls = log_formatters[name[len(prefix):]][0] diff --git a/testing/mozbase/mozlog/tests/test_structured.py b/testing/mozbase/mozlog/tests/test_structured.py index abeb73b7eb6..0b91c18ea87 100644 --- a/testing/mozbase/mozlog/tests/test_structured.py +++ b/testing/mozbase/mozlog/tests/test_structured.py @@ -1,6 +1,6 @@ import argparse +import optparse import os -import time import unittest import StringIO import json @@ -10,6 +10,7 @@ from mozlog.structured import ( reader, structuredlog, stdadapter, + handlers, ) @@ -195,6 +196,14 @@ class TestCommandline(unittest.TestCase): logger = commandline.setup_logging("test", args, {}) self.assertEqual(len(logger.handlers), 1) + def test_setup_logging_optparse(self): + parser = optparse.OptionParser() + commandline.add_logging_group(parser) + args, _ = parser.parse_args(["--log-raw=-"]) + logger = commandline.setup_logging("test_optparse", args, {}) + self.assertEqual(len(logger.handlers), 1) + self.assertIsInstance(logger.handlers[0], handlers.StreamHandler) + class TestReader(unittest.TestCase): def to_file_like(self, obj): data_str = "\n".join(json.dumps(item) for item in obj) From 8e063af010d4a7002f31bc2f4ef7b8601b84f41a Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Thu, 12 Jun 2014 17:06:06 -0400 Subject: [PATCH 65/68] Backed out changeset a461a267cf62 (bug 1021248) for suspicion of causing B2G fixed-1.html perma-fail. CLOSED TREE --- gfx/layers/client/TiledContentClient.cpp | 20 ++++++++++++++++++-- gfx/layers/client/TiledContentClient.h | 3 +++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/gfx/layers/client/TiledContentClient.cpp b/gfx/layers/client/TiledContentClient.cpp index b74be06a112..eac21f1eda9 100644 --- a/gfx/layers/client/TiledContentClient.cpp +++ b/gfx/layers/client/TiledContentClient.cpp @@ -120,6 +120,8 @@ TiledContentClient::UseTiledLayerBuffer(TiledBufferType aType) } SharedFrameMetricsHelper::SharedFrameMetricsHelper() + : mLastProgressiveUpdateWasLowPrecision(false) + , mProgressiveUpdateWasInDanger(false) { MOZ_COUNT_CTOR(SharedFrameMetricsHelper); } @@ -163,6 +165,17 @@ SharedFrameMetricsHelper::UpdateFromCompositorFrameMetrics( aCompositionBounds = ParentLayerRect(compositorMetrics.mCompositionBounds); aZoom = compositorMetrics.GetZoomToParent(); + // Reset the checkerboard risk flag when switching to low precision + // rendering. + if (aLowPrecision && !mLastProgressiveUpdateWasLowPrecision) { + // Skip low precision rendering until we're at risk of checkerboarding. + if (!mProgressiveUpdateWasInDanger) { + return true; + } + mProgressiveUpdateWasInDanger = false; + } + mLastProgressiveUpdateWasLowPrecision = aLowPrecision; + // Always abort updates if the resolution has changed. There's no use // in drawing at the incorrect resolution. if (!FuzzyEquals(compositorMetrics.GetZoom().scale, contentMetrics.GetZoom().scale)) { @@ -184,8 +197,11 @@ SharedFrameMetricsHelper::UpdateFromCompositorFrameMetrics( // When not a low precision pass and the page is in danger of checker boarding // abort update. - if (!aLowPrecision && AboutToCheckerboard(contentMetrics, compositorMetrics)) { - return true; + if (!aLowPrecision && !mProgressiveUpdateWasInDanger) { + if (AboutToCheckerboard(contentMetrics, compositorMetrics)) { + mProgressiveUpdateWasInDanger = true; + return true; + } } // Abort drawing stale low-precision content if there's a more recent diff --git a/gfx/layers/client/TiledContentClient.h b/gfx/layers/client/TiledContentClient.h index 5cf44b1f81e..2bb33930ebd 100644 --- a/gfx/layers/client/TiledContentClient.h +++ b/gfx/layers/client/TiledContentClient.h @@ -342,6 +342,9 @@ public: */ bool AboutToCheckerboard(const FrameMetrics& aContentMetrics, const FrameMetrics& aCompositorMetrics); +private: + bool mLastProgressiveUpdateWasLowPrecision; + bool mProgressiveUpdateWasInDanger; }; /** From b83352b6f4666cd1cec1335039499f139a5b0121 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Thu, 12 Jun 2014 02:34:00 -0400 Subject: [PATCH 66/68] Bug 962645 - Support wait between press->release action chain. r=mdas wait() before press() should not raise "MarionetteException: Element has not been pressed." --- .../marionette/tests/unit/single_finger_functions.py | 9 +++++++-- .../client/marionette/tests/unit/test_single_finger.py | 5 ++++- .../marionette/tests/unit/test_single_finger_desktop.py | 5 ++++- testing/marionette/marionette-listener.js | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/testing/marionette/client/marionette/tests/unit/single_finger_functions.py b/testing/marionette/client/marionette/tests/unit/single_finger_functions.py index 1a6a3ead98a..3852945e889 100644 --- a/testing/marionette/client/marionette/tests/unit/single_finger_functions.py +++ b/testing/marionette/client/marionette/tests/unit/single_finger_functions.py @@ -1,10 +1,15 @@ from marionette import Actions -def press_release(marionette, wait_for_condition, expected): +def press_release(marionette, times, wait_for_condition, expected): testAction = marionette.absolute_url("testAction.html") marionette.navigate(testAction) action = Actions(marionette) button = marionette.find_element("id", "button1") - action.press(button).release().perform() + action.press(button).release() + # Insert wait between each press and release chain. + for _ in range(times-1): + action.wait(0.1) + action.press(button).release() + action.perform() wait_for_condition(lambda m: expected in m.execute_script("return document.getElementById('button1').innerHTML;")) def move_element(marionette, wait_for_condition, expected1, expected2): diff --git a/testing/marionette/client/marionette/tests/unit/test_single_finger.py b/testing/marionette/client/marionette/tests/unit/test_single_finger.py index 62f526ece2c..a914ec00e4c 100644 --- a/testing/marionette/client/marionette/tests/unit/test_single_finger.py +++ b/testing/marionette/client/marionette/tests/unit/test_single_finger.py @@ -19,7 +19,10 @@ from single_finger_functions import ( class testSingleFinger(MarionetteTestCase): def test_press_release(self): - press_release(self.marionette, self.wait_for_condition, "button1-touchstart-touchend-mousemove-mousedown-mouseup-click") + press_release(self.marionette, 1, self.wait_for_condition, "button1-touchstart-touchend-mousemove-mousedown-mouseup-click") + + def test_press_release_twice(self): + press_release(self.marionette, 2, self.wait_for_condition, "button1-touchstart-touchend-mousemove-mousedown-mouseup-click-touchstart-touchend-mousemove-mousedown-mouseup-click") def test_move_element(self): move_element(self.marionette, self.wait_for_condition, "button1-touchstart", "button2-touchmove-touchend") diff --git a/testing/marionette/client/marionette/tests/unit/test_single_finger_desktop.py b/testing/marionette/client/marionette/tests/unit/test_single_finger_desktop.py index 15243e158f4..bbfa29b055d 100644 --- a/testing/marionette/client/marionette/tests/unit/test_single_finger_desktop.py +++ b/testing/marionette/client/marionette/tests/unit/test_single_finger_desktop.py @@ -59,7 +59,10 @@ prefs.setIntPref("ui.click_hold_context_menus.delay", arguments[0]); super(MarionetteTestCase, self).tearDown() def test_press_release(self): - press_release(self.marionette, self.wait_for_condition, "button1-mousemove-mousedown-mouseup-click") + press_release(self.marionette, 1, self.wait_for_condition, "button1-mousemove-mousedown-mouseup-click") + + def test_press_release_twice(self): + press_release(self.marionette, 2, self.wait_for_condition, "button1-mousemove-mousedown-mouseup-click-mousemove-mousedown-mouseup-click") def test_move_element(self): move_element(self.marionette, self.wait_for_condition, "button1-mousemove-mousedown", "button2-mousemove-mouseup") diff --git a/testing/marionette/marionette-listener.js b/testing/marionette/marionette-listener.js index e20d73c588d..a908429c0c9 100644 --- a/testing/marionette/marionette-listener.js +++ b/testing/marionette/marionette-listener.js @@ -969,7 +969,7 @@ function actions(chain, touchId, command_id, i) { let el; let c; i++; - if (command != 'press') { + if (command != 'press' && command != 'wait') { //if mouseEventsOnly, then touchIds isn't used if (!(touchId in touchIds) && !mouseEventsOnly) { sendError("Element has not been pressed", 500, null, command_id); From dce148f13445513d4d8fcce4996579d77200afcb Mon Sep 17 00:00:00 2001 From: Lars T Hansen Date: Thu, 12 Jun 2014 23:12:12 +0200 Subject: [PATCH 67/68] Bug 1023753 - Define JSGC_FJGENERATIONAL only if JS_THREADSAFE. r=ted --- js/src/configure.in | 2 ++ js/src/moz.build | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/js/src/configure.in b/js/src/configure.in index f1edd3a2f08..509b273ea76 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -2791,6 +2791,8 @@ MOZ_ARG_DISABLE_BOOL(threadsafe, if test -n "$JS_THREADSAFE"; then AC_DEFINE(JS_THREADSAFE) fi +JS_THREADSAFE_CONFIGURED=$JS_THREADSAFE +AC_SUBST(JS_THREADSAFE_CONFIGURED) if test "$_USE_SYSTEM_NSPR" || (test "$NSPR_CFLAGS" -o "$NSPR_LIBS"); then _HAS_NSPR=1 diff --git a/js/src/moz.build b/js/src/moz.build index 28104a390e5..3e055b02c62 100644 --- a/js/src/moz.build +++ b/js/src/moz.build @@ -458,9 +458,8 @@ if CONFIG['NIGHTLY_BUILD']: DEFINES['ENABLE_PARALLEL_JS'] = True DEFINES['ENABLE_BINARYDATA'] = True DEFINES['ENABLE_SHARED_ARRAY_BUFFER'] = True - if CONFIG['ENABLE_ION']: - if CONFIG['JSGC_GENERATIONAL_CONFIGURED']: - DEFINES['JSGC_FJGENERATIONAL'] = True + if CONFIG['ENABLE_ION'] and CONFIG['JSGC_GENERATIONAL_CONFIGURED'] and CONFIG['JS_THREADSAFE_CONFIGURED']: + DEFINES['JSGC_FJGENERATIONAL'] = True DEFINES['EXPORT_JS_API'] = True From 525203360e446f5e635a0d8768809c30754c08cd Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Thu, 12 Jun 2014 18:20:16 -0400 Subject: [PATCH 68/68] No bug - Adjust expected assertions for test_playback_rate.html on Linux. --- content/media/test/test_playback_rate.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/media/test/test_playback_rate.html b/content/media/test/test_playback_rate.html index bb88f80854f..41242896269 100644 --- a/content/media/test/test_playback_rate.html +++ b/content/media/test/test_playback_rate.html @@ -18,7 +18,7 @@ // 'mCurrentFrameTime <= clock_time || mPlaybackRate <= 0', // file MediaDecoderStateMachine.cpp, line 2379 // This test is currently disabled on Android debug for wildly-varying numbers of the above. -SimpleTest.expectAssertions(5, 9); +SimpleTest.expectAssertions(3, 9); if (navigator.platform.startsWith("Win")) { SimpleTest.expectAssertions(4, 5); }