Backout 2044222a3f1d (bug 820230) for build failures on a CLOSED TREE

This commit is contained in:
Ed Morley 2012-12-11 16:24:11 +00:00
parent 9e5c675544
commit 7980450712
5 changed files with 72 additions and 65 deletions

View File

@ -34,6 +34,8 @@
#include "nsThreadUtils.h"
#include "nsIContent.h"
#include "nsCharSeparatedTokenizer.h"
#include "gfxContext.h"
#include "gfxFont.h"
#include "nsContentList.h"
#include "mozilla/AutoRestore.h"
@ -100,6 +102,7 @@ struct nsIntMargin;
class nsPIDOMWindow;
class nsIDocumentLoaderFactory;
class nsIDOMHTMLInputElement;
class gfxTextObjectPaint;
namespace mozilla {
@ -2119,6 +2122,13 @@ public:
static nsIEditor* GetHTMLEditor(nsPresContext* aPresContext);
static bool PaintSVGGlyph(Element *aElement, gfxContext *aContext,
gfxFont::DrawMode aDrawMode,
gfxTextObjectPaint *aObjectPaint);
static bool GetSVGGlyphExtents(Element *aElement, const gfxMatrix& aSVGToAppSpace,
gfxRect *aResult);
/**
* Check whether a spec feature/version is supported.
* @param aObject the object, which should support the feature,

View File

@ -122,6 +122,10 @@
#include "nsILoadContext.h"
#include "nsTextFragment.h"
#include "mozilla/Selection.h"
#include "nsSVGUtils.h"
#include "nsISVGChildFrame.h"
#include "nsRenderingContext.h"
#include "gfxSVGGlyphs.h"
#ifdef IBMBIDI
#include "nsIBidiKeyboard.h"
@ -6900,6 +6904,60 @@ nsContentUtils::JSArrayToAtomArray(JSContext* aCx, const JS::Value& aJSArray,
return NS_OK;
}
/* static */
bool
nsContentUtils::PaintSVGGlyph(Element *aElement, gfxContext *aContext,
gfxFont::DrawMode aDrawMode,
gfxTextObjectPaint *aObjectPaint)
{
nsIFrame *frame = aElement->GetPrimaryFrame();
if (!frame) {
NS_WARNING("No frame for SVG glyph");
return false;
}
nsISVGChildFrame *displayFrame = do_QueryFrame(frame);
if (!displayFrame) {
NS_WARNING("Non SVG frame for SVG glyph");
return false;
}
nsRenderingContext context;
context.Init(frame->PresContext()->DeviceContext(), aContext);
context.AddUserData(&gfxTextObjectPaint::sUserDataKey, aObjectPaint, nullptr);
nsresult rv = displayFrame->PaintSVG(&context, nullptr);
NS_ENSURE_SUCCESS(rv, false);
return true;
}
/* static */
bool
nsContentUtils::GetSVGGlyphExtents(Element *aElement, const gfxMatrix& aSVGToAppSpace,
gfxRect *aResult)
{
nsIFrame *frame = aElement->GetPrimaryFrame();
if (!frame) {
NS_WARNING("No frame for SVG glyph");
return false;
}
nsISVGChildFrame *displayFrame = do_QueryFrame(frame);
if (!displayFrame) {
NS_WARNING("Non SVG frame for SVG glyph");
return false;
}
*aResult = displayFrame->GetBBoxContribution(aSVGToAppSpace,
nsSVGUtils::eBBoxIncludeFill | nsSVGUtils::eBBoxIncludeFillGeometry |
nsSVGUtils::eBBoxIncludeStroke | nsSVGUtils::eBBoxIncludeStrokeGeometry |
nsSVGUtils::eBBoxIncludeMarkers);
return true;
}
// static
void
nsContentUtils::GetSelectionInTextControl(Selection* aSelection,

View File

@ -43,6 +43,7 @@
#include "nsIDOMNodeList.h"
#include "nsString.h"
#include "nsIDocument.h"
#include "nsPrintfCString.h"
#include "nsICategoryManager.h"
#include "nsIDocumentLoaderFactory.h"
#include "nsIContentViewer.h"
@ -55,11 +56,11 @@
#include "nsXMLContentSink.h"
#include "nsNetUtil.h"
#include "nsIInputStream.h"
#include "nsContentUtils.h"
#include "nsStringStream.h"
#include "nsStreamUtils.h"
#include "nsIPrincipal.h"
#include "Element.h"
#include "nsSVGUtils.h"
#define SVG_CONTENT_TYPE NS_LITERAL_CSTRING("image/svg+xml")
#define UTF8_CHARSET NS_LITERAL_CSTRING("utf-8")
@ -229,7 +230,7 @@ gfxSVGGlyphs::RenderGlyph(gfxContext *aContext, uint32_t aGlyphId,
Element *glyph = mGlyphIdMap.Get(aGlyphId);
NS_ASSERTION(glyph, "No glyph element. Should check with HasSVGGlyph() first!");
return nsSVGUtils::PaintSVGGlyph(glyph, aContext, aDrawMode, aObjectPaint);
return nsContentUtils::PaintSVGGlyph(glyph, aContext, aDrawMode, aObjectPaint);
}
bool
@ -239,7 +240,7 @@ gfxSVGGlyphs::GetGlyphExtents(uint32_t aGlyphId, const gfxMatrix& aSVGToAppSpace
Element *glyph = mGlyphIdMap.Get(aGlyphId);
NS_ASSERTION(glyph, "No glyph element. Should check with HasSVGGlyph() first!");
return nsSVGUtils::GetSVGGlyphExtents(glyph, aSVGToAppSpace, aResult);
return nsContentUtils::GetSVGGlyphExtents(glyph, aSVGToAppSpace, aResult);
}
Element *

View File

@ -1864,41 +1864,3 @@ nsSVGUtils::SetupCairoStroke(nsIFrame* aFrame, gfxContext* aContext,
return SetupCairoStrokePaint(aFrame, aContext, aObjectPaint);
}
bool
nsSVGUtils::PaintSVGGlyph(Element* aElement, gfxContext* aContext,
gfxFont::DrawMode aDrawMode,
gfxTextObjectPaint* aObjectPaint)
{
nsIFrame* frame = aElement->GetPrimaryFrame();
nsISVGChildFrame* svgFrame = do_QueryFrame(frame);
MOZ_ASSERT(!frame || svgFrame, "Non SVG frame for SVG glyph");
if (svgFrame) {
nsRenderingContext context;
context.Init(frame->PresContext()->DeviceContext(), aContext);
context.AddUserData(&gfxTextObjectPaint::sUserDataKey, aObjectPaint, nullptr);
nsresult rv = svgFrame->PaintSVG(&context, nullptr);
if (NS_SUCCEEDED(rv)) {
return true;
}
}
return false;
}
bool
nsSVGUtils::GetSVGGlyphExtents(Element* aElement,
const gfxMatrix& aSVGToAppSpace,
gfxRect* aResult)
{
nsIFrame* frame = aElement->GetPrimaryFrame();
nsISVGChildFrame* svgFrame = do_QueryFrame(frame);
MOZ_ASSERT(!frame || svgFrame, "Non SVG frame for SVG glyph");
if (svgFrame) {
*aResult = svgFrame->GetBBoxContribution(aSVGToAppSpace,
nsSVGUtils::eBBoxIncludeFill | nsSVGUtils::eBBoxIncludeFillGeometry |
nsSVGUtils::eBBoxIncludeStroke | nsSVGUtils::eBBoxIncludeStrokeGeometry |
nsSVGUtils::eBBoxIncludeMarkers);
return true;
}
return false;
}

View File

@ -10,7 +10,6 @@
#define _USE_MATH_DEFINES
#include <math.h>
#include "gfxFont.h"
#include "gfxMatrix.h"
#include "gfxPoint.h"
#include "gfxRect.h"
@ -204,7 +203,6 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsISVGFilterProperty, NS_ISVGFILTERPROPERTY_IID)
class nsSVGUtils
{
public:
typedef mozilla::dom::Element Element;
static void Init();
@ -633,28 +631,6 @@ public:
* property on the element.
*/
static uint16_t GetGeometryHitTestFlags(nsIFrame* aFrame);
/**
* Render a SVG glyph.
* @param aElement the SVG glyph element to render
* @param aContext the thebes aContext to draw to
* @param aDrawMode fill or stroke or both (see gfxFont::DrawMode)
* @return true if rendering succeeded
*/
static bool PaintSVGGlyph(Element* aElement, gfxContext* aContext,
gfxFont::DrawMode aDrawMode,
gfxTextObjectPaint* aObjectPaint);
/**
* Get the extents of a SVG glyph.
* @param aElement the SVG glyph element
* @param aSVGToAppSpace the matrix mapping the SVG glyph space to the
* target context space
* @param aResult the result (valid when true is returned)
* @return true if calculating the extents succeeded
*/
static bool GetSVGGlyphExtents(Element* aElement,
const gfxMatrix& aSVGToAppSpace,
gfxRect* aResult);
};
#endif