diff options
Diffstat (limited to 'src/3rdparty/webkit/WebCore/html')
17 files changed, 427 insertions, 247 deletions
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.cpp b/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.cpp new file mode 100644 index 0000000..dbfed28 --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "HTMLAllCollection.h" + +#include "Node.h" + +namespace WebCore { + +PassRefPtr<HTMLAllCollection> HTMLAllCollection::create(PassRefPtr<Node> base) +{ + return adoptRef(new HTMLAllCollection(base)); +} + +HTMLAllCollection::HTMLAllCollection(PassRefPtr<Node> base) + : HTMLCollection(base, DocAll) +{ +} + +HTMLAllCollection::~HTMLAllCollection() +{ +} + +} // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.h b/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.h new file mode 100644 index 0000000..1dd3ede --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef HTMLAllCollection_h +#define HTMLAllCollection_h + +#include "HTMLCollection.h" + +namespace WebCore { + +class HTMLAllCollection : public HTMLCollection { +public: + static PassRefPtr<HTMLAllCollection> create(PassRefPtr<Node>); + virtual ~HTMLAllCollection(); + +private: + HTMLAllCollection(PassRefPtr<Node>); +}; + +} // namespace WebCore + +#endif // HTMLAllCollection_h diff --git a/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.idl b/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.idl new file mode 100644 index 0000000..d36f41e --- /dev/null +++ b/src/3rdparty/webkit/WebCore/html/HTMLAllCollection.idl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module html { + + interface [ + GenerateConstructor, + HasIndexGetter, + HasNameGetter, + CustomCall, + MasqueradesAsUndefined + ] HTMLAllCollection { + readonly attribute unsigned long length; + [Custom] Node item(in unsigned long index); + [Custom] Node namedItem(in DOMString name); + + // FIXME: This should return an HTMLAllCollection. + NodeList tags(in DOMString name); + }; + +} diff --git a/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp index 335b20f..7bae6e3 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp @@ -172,10 +172,11 @@ CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type) if (m_context && !m_context->is3d()) return 0; if (!m_context) { - m_context = new CanvasRenderingContext3D(this); - - // Need to make sure a RenderLayer and compositing layer get created for the Canvas - setNeedsStyleRecalc(SyntheticStyleChange); + m_context = CanvasRenderingContext3D::create(this); + if (m_context) { + // Need to make sure a RenderLayer and compositing layer get created for the Canvas + setNeedsStyleRecalc(SyntheticStyleChange); + } } return m_context.get(); } diff --git a/src/3rdparty/webkit/WebCore/html/HTMLCollection.h b/src/3rdparty/webkit/WebCore/html/HTMLCollection.h index b04bcbc..eea1777 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLCollection.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLCollection.h @@ -64,6 +64,7 @@ public: protected: HTMLCollection(PassRefPtr<Node> base, CollectionType, CollectionCache*); + HTMLCollection(PassRefPtr<Node> base, CollectionType); CollectionCache* info() const { return m_info; } void resetCollectionInfo() const; @@ -71,8 +72,6 @@ protected: mutable bool m_idsDone; // for nextNamedItem() private: - HTMLCollection(PassRefPtr<Node> base, CollectionType); - virtual Element* itemAfter(Element*) const; virtual unsigned calcLength() const; virtual void updateNameCache() const; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLCollection.idl b/src/3rdparty/webkit/WebCore/html/HTMLCollection.idl index 1ba5ec7..45d1127 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLCollection.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLCollection.idl @@ -34,8 +34,9 @@ module html { [Custom] Node item(in unsigned long index); [Custom] Node namedItem(in DOMString name); - // Extensions +#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C NodeList tags(in DOMString name); +#endif }; } diff --git a/src/3rdparty/webkit/WebCore/html/HTMLDocument.idl b/src/3rdparty/webkit/WebCore/html/HTMLDocument.idl index 3dd7a07..d250741 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLDocument.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLDocument.idl @@ -39,7 +39,7 @@ module html { #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT // FIXME: This should eventually be available (if they are wanted) for all languages. - attribute [Custom, Deletable] HTMLCollection all; + attribute [Custom, Deletable] HTMLAllCollection all; #endif void clear(); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp index ed3405a..f25c908 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.cpp @@ -1549,9 +1549,16 @@ void HTMLInputElement::defaultEventHandler(Event* evt) if (r && r->isTextField()) toRenderTextControl(r)->setEdited(false); } - // Form may never have been present, or may have been destroyed by the change event. - if (form()) - form()->submitClick(evt); + + RefPtr<HTMLFormElement> formForSubmission = form(); + // If there is no form and the element is an <isindex>, then create a temporary form just to be used for submission. + if (!formForSubmission && inputType() == ISINDEX) + formForSubmission = createTemporaryFormForIsIndex(); + + // Form may never have been present, or may have been destroyed by code responding to the change event. + if (formForSubmission) + formForSubmission->submitClick(evt); + evt->setDefaultHandled(); return; } @@ -1569,6 +1576,19 @@ void HTMLInputElement::defaultEventHandler(Event* evt) HTMLFormControlElementWithState::defaultEventHandler(evt); } +PassRefPtr<HTMLFormElement> HTMLInputElement::createTemporaryFormForIsIndex() +{ + RefPtr<HTMLFormElement> form = new HTMLFormElement(formTag, document()); + form->registerFormElement(this); + form->setMethod("GET"); + if (!document()->baseURL().isEmpty()) { + // We treat the href property of the <base> element as the form action, as per section 7.5 + // "Queries and Indexes" of the HTML 2.0 spec. <http://www.w3.org/MarkUp/html-spec/html-spec_7.html#SEC7.5>. + form->setAction(document()->baseURL().string()); + } + return form.release(); +} + bool HTMLInputElement::isURLAttribute(Attribute *attr) const { return (attr->name() == srcAttr); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h index 799d92c..0e2da32 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLInputElement.h @@ -256,6 +256,8 @@ private: virtual bool isOptionalFormControl() const { return !isRequiredFormControl(); } virtual bool isRequiredFormControl() const; + PassRefPtr<HTMLFormElement> createTemporaryFormForIsIndex(); + #if ENABLE(DATALIST) HTMLDataListElement* dataList() const; #endif diff --git a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp index 11ca3ba..729aceb 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.cpp @@ -247,16 +247,12 @@ void HTMLMediaElement::insertedIntoDocument() scheduleLoad(); } -void HTMLMediaElement::willRemove() -{ - if (m_isFullscreen) - exitFullscreen(); - HTMLElement::willRemove(); -} void HTMLMediaElement::removedFromDocument() { if (m_networkState > NETWORK_EMPTY) pause(); + if (m_isFullscreen) + exitFullscreen(); HTMLElement::removedFromDocument(); } @@ -1678,6 +1674,9 @@ void HTMLMediaElement::userCancelledLoad() void HTMLMediaElement::documentWillBecomeInactive() { + if (m_isFullscreen) + exitFullscreen(); + m_inActiveDocument = false; userCancelledLoad(); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h index 0005e07..405f013 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h +++ b/src/3rdparty/webkit/WebCore/html/HTMLMediaElement.h @@ -57,7 +57,6 @@ public: virtual bool rendererIsNeeded(RenderStyle*); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); virtual void insertedIntoDocument(); - virtual void willRemove(); virtual void removedFromDocument(); virtual void attach(); virtual void recalcStyle(StyleChange); diff --git a/src/3rdparty/webkit/WebCore/html/HTMLOptionsCollection.idl b/src/3rdparty/webkit/WebCore/html/HTMLOptionsCollection.idl index 5f85fcb..a7e191a 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLOptionsCollection.idl +++ b/src/3rdparty/webkit/WebCore/html/HTMLOptionsCollection.idl @@ -21,7 +21,6 @@ module html { // FIXME: The W3C spec says that HTMLOptionsCollection should not have a parent class. - interface [ GenerateNativeConverter, HasCustomIndexSetter, @@ -36,9 +35,9 @@ module html { raises (DOMException); [Custom] void remove(in unsigned long index); -#if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT - Node item(in unsigned long index); - Node namedItem(in DOMString name); +#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C + Node item(in unsigned long index); + Node namedItem(in DOMString name); #endif }; diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp b/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp index 33af997..91285d9 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp @@ -416,13 +416,13 @@ HTMLTokenizer::State HTMLTokenizer::parseNonHTMLText(SegmentedString& src, State return state; } - + HTMLTokenizer::State HTMLTokenizer::scriptHandler(State state) { // We are inside a <script> bool doScriptExec = false; int startLine = m_currentScriptTagStartLineNumber + 1; // Script line numbers are 1 based, HTMLTokenzier line numbers are 0 based - + // Reset m_currentScriptTagStartLineNumber to indicate that we've finished parsing the current script element m_currentScriptTagStartLineNumber = 0; @@ -551,7 +551,13 @@ HTMLTokenizer::State HTMLTokenizer::scriptExecution(const ScriptSourceCode& sour if (m_fragment || !m_doc->frame()) return state; m_executingScript++; - + +#if ENABLE(INSPECTOR) + InspectorTimelineAgent* timelineAgent = m_doc->inspectorTimelineAgent(); + if (timelineAgent) + timelineAgent->willEvaluateScriptTag(sourceCode.url().isNull() ? String() : sourceCode.url().string(), sourceCode.startLine()); +#endif + SegmentedString* savedPrependingSrc = m_currentPrependingSrc; SegmentedString prependingSrc; m_currentPrependingSrc = &prependingSrc; @@ -608,7 +614,12 @@ HTMLTokenizer::State HTMLTokenizer::scriptExecution(const ScriptSourceCode& sour } m_currentPrependingSrc = savedPrependingSrc; - + +#if ENABLE(INSPECTOR) + if (timelineAgent) + timelineAgent->didEvaluateScriptTag(); +#endif + return state; } @@ -1613,7 +1624,7 @@ inline bool HTMLTokenizer::continueProcessing(int& processedCount, double startT processedCount++; return true; } - + void HTMLTokenizer::write(const SegmentedString& str, bool appendData) { if (!m_buffer) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext.h index 9ac9e57..f752377 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext.h +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext.h @@ -38,6 +38,7 @@ namespace WebCore { CanvasRenderingContext(HTMLCanvasElement*); virtual ~CanvasRenderingContext() { } + // Ref and deref the m_canvas void ref(); void deref(); @@ -46,7 +47,7 @@ namespace WebCore { virtual bool is2d() const { return false; } virtual bool is3d() const { return false; } - protected: + private: HTMLCanvasElement* m_canvas; }; diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp index 5e25b93..3341901 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp @@ -165,10 +165,10 @@ void CanvasRenderingContext2D::setStrokeStyle(PassRefPtr<CanvasStyle> style) if (!style) return; - if (m_canvas->originClean()) { + if (canvas()->originClean()) { if (CanvasPattern* pattern = style->canvasPattern()) { if (!pattern->originClean()) - m_canvas->setOriginTainted(); + canvas()->setOriginTainted(); } } @@ -189,10 +189,10 @@ void CanvasRenderingContext2D::setFillStyle(PassRefPtr<CanvasStyle> style) if (!style) return; - if (m_canvas->originClean()) { + if (canvas()->originClean()) { if (CanvasPattern* pattern = style->canvasPattern()) { if (!pattern->originClean()) - m_canvas->setOriginTainted(); + canvas()->setOriginTainted(); } } @@ -447,7 +447,7 @@ void CanvasRenderingContext2D::setTransform(float m11, float m12, float m21, flo if (!ctm.isInvertible()) return; c->concatCTM(c->getCTM().inverse()); - c->concatCTM(m_canvas->baseTransform()); + c->concatCTM(canvas()->baseTransform()); state().m_transform.multiply(ctm.inverse()); m_path.transform(ctm); @@ -630,7 +630,7 @@ void CanvasRenderingContext2D::rect(float x, float y, float width, float height) #if ENABLE(DASHBOARD_SUPPORT) void CanvasRenderingContext2D::clearPathForDashboardBackwardCompatibilityMode() { - if (Settings* settings = m_canvas->document()->settings()) + if (Settings* settings = canvas()->document()->settings()) if (settings->usesDashboardBackwardCompatibilityMode()) m_path.clear(); } @@ -935,8 +935,8 @@ static inline FloatRect normalizeRect(const FloatRect& rect) void CanvasRenderingContext2D::checkOrigin(const KURL& url) { - if (m_canvas->document()->securityOrigin()->taintsCanvas(url)) - m_canvas->setOriginTainted(); + if (canvas()->document()->securityOrigin()->taintsCanvas(url)) + canvas()->setOriginTainted(); } void CanvasRenderingContext2D::checkOrigin(const String& url) @@ -986,11 +986,11 @@ void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, const FloatRec if (!cachedImage) return; - if (m_canvas->originClean()) + if (canvas()->originClean()) checkOrigin(cachedImage->response().url()); - if (m_canvas->originClean() && !cachedImage->image()->hasSingleSecurityOrigin()) - m_canvas->setOriginTainted(); + if (canvas()->originClean() && !cachedImage->image()->hasSingleSecurityOrigin()) + canvas()->setOriginTainted(); FloatRect sourceRect = c->roundToDevicePixels(srcRect); FloatRect destRect = c->roundToDevicePixels(dstRect); @@ -1012,14 +1012,14 @@ void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas, drawImage(canvas, FloatRect(0, 0, canvas->width(), canvas->height()), FloatRect(x, y, width, height), ec); } -void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas, const FloatRect& srcRect, +void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionCode& ec) { - ASSERT(canvas); + ASSERT(sourceCanvas); ec = 0; - FloatRect srcCanvasRect = FloatRect(FloatPoint(), canvas->size()); + FloatRect srcCanvasRect = FloatRect(FloatPoint(), sourceCanvas->size()); if (!srcCanvasRect.contains(normalizeRect(srcRect)) || srcRect.width() == 0 || srcRect.height() == 0) { ec = INDEX_SIZE_ERR; return; @@ -1038,12 +1038,12 @@ void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas, const FloatR FloatRect destRect = c->roundToDevicePixels(dstRect); // FIXME: Do this through platform-independent GraphicsContext API. - ImageBuffer* buffer = canvas->buffer(); + ImageBuffer* buffer = sourceCanvas->buffer(); if (!buffer) return; - if (!canvas->originClean()) - m_canvas->setOriginTainted(); + if (!sourceCanvas->originClean()) + canvas()->setOriginTainted(); c->drawImage(buffer->image(), destRect, sourceRect, state().m_globalComposite); willDraw(destRect); // This call comes after drawImage, since the buffer we draw into may be our own, and we need to make sure it is dirty. @@ -1088,11 +1088,11 @@ void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, const FloatRec if (!state().m_invertibleCTM) return; - if (m_canvas->originClean()) + if (canvas()->originClean()) checkOrigin(video->currentSrc()); - if (m_canvas->originClean() && !video->hasSingleSecurityOrigin()) - m_canvas->setOriginTainted(); + if (canvas()->originClean() && !video->hasSingleSecurityOrigin()) + canvas()->setOriginTainted(); FloatRect sourceRect = c->roundToDevicePixels(srcRect); FloatRect destRect = c->roundToDevicePixels(dstRect); @@ -1121,11 +1121,11 @@ void CanvasRenderingContext2D::drawImageFromRect(HTMLImageElement* image, if (!cachedImage) return; - if (m_canvas->originClean()) + if (canvas()->originClean()) checkOrigin(cachedImage->response().url()); - if (m_canvas->originClean() && !cachedImage->image()->hasSingleSecurityOrigin()) - m_canvas->setOriginTainted(); + if (canvas()->originClean() && !cachedImage->image()->hasSingleSecurityOrigin()) + canvas()->setOriginTainted(); GraphicsContext* c = drawingContext(); if (!c) @@ -1155,7 +1155,7 @@ void CanvasRenderingContext2D::setCompositeOperation(const String& operation) void CanvasRenderingContext2D::prepareGradientForDashboard(CanvasGradient* gradient) const { #if ENABLE(DASHBOARD_SUPPORT) - if (Settings* settings = m_canvas->document()->settings()) + if (Settings* settings = canvas()->document()->settings()) if (settings->usesDashboardBackwardCompatibilityMode()) gradient->setDashboardCompatibilityMode(); #else @@ -1205,7 +1205,7 @@ PassRefPtr<CanvasPattern> CanvasRenderingContext2D::createPattern(HTMLImageEleme if (!cachedImage || !image->cachedImage()->image()) return CanvasPattern::create(Image::nullImage(), repeatX, repeatY, true); - bool originClean = !m_canvas->document()->securityOrigin()->taintsCanvas(KURL(KURL(), cachedImage->url())); + bool originClean = !canvas()->document()->securityOrigin()->taintsCanvas(KURL(KURL(), cachedImage->url())); return CanvasPattern::create(cachedImage->image(), repeatX, repeatY, originClean); } @@ -1253,12 +1253,12 @@ void CanvasRenderingContext2D::willDraw(const FloatRect& r, unsigned options) // we'd have to keep the clip path around. } - m_canvas->willDraw(dirtyRect); + canvas()->willDraw(dirtyRect); } GraphicsContext* CanvasRenderingContext2D::drawingContext() const { - return m_canvas->drawingContext(); + return canvas()->drawingContext(); } static PassRefPtr<ImageData> createEmptyImageData(const IntSize& size) @@ -1276,7 +1276,7 @@ PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(float sw, float return 0; } FloatSize unscaledSize(sw, sh); - IntSize scaledSize = m_canvas->convertLogicalToDevice(unscaledSize); + IntSize scaledSize = canvas()->convertLogicalToDevice(unscaledSize); if (scaledSize.width() < 1) scaledSize.setWidth(1); if (scaledSize.height() < 1) @@ -1287,18 +1287,18 @@ PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(float sw, float PassRefPtr<ImageData> CanvasRenderingContext2D::getImageData(float sx, float sy, float sw, float sh, ExceptionCode& ec) const { - if (!m_canvas->originClean()) { + if (!canvas()->originClean()) { ec = SECURITY_ERR; return 0; } FloatRect unscaledRect(sx, sy, sw, sh); - IntRect scaledRect = m_canvas->convertLogicalToDevice(unscaledRect); + IntRect scaledRect = canvas()->convertLogicalToDevice(unscaledRect); if (scaledRect.width() < 1) scaledRect.setWidth(1); if (scaledRect.height() < 1) scaledRect.setHeight(1); - ImageBuffer* buffer = m_canvas ? m_canvas->buffer() : 0; + ImageBuffer* buffer = canvas() ? canvas()->buffer() : 0; if (!buffer) return createEmptyImageData(scaledRect.size()); return buffer->getUnmultipliedImageData(scaledRect); @@ -1326,7 +1326,7 @@ void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, return; } - ImageBuffer* buffer = m_canvas->buffer(); + ImageBuffer* buffer = canvas()->buffer(); if (!buffer) return; @@ -1363,7 +1363,7 @@ String CanvasRenderingContext2D::font() const void CanvasRenderingContext2D::setFont(const String& newFont) { RefPtr<CSSMutableStyleDeclaration> tempDecl = CSSMutableStyleDeclaration::create(); - CSSParser parser(!m_canvas->document()->inCompatMode()); // Use the parse mode of the canvas' document when parsing CSS. + CSSParser parser(!canvas()->document()->inCompatMode()); // Use the parse mode of the canvas' document when parsing CSS. String declarationText("font: "); declarationText += newFont; @@ -1377,11 +1377,11 @@ void CanvasRenderingContext2D::setFont(const String& newFont) // Map the <canvas> font into the text style. If the font uses keywords like larger/smaller, these will work // relative to the canvas. RefPtr<RenderStyle> newStyle = RenderStyle::create(); - if (m_canvas->computedStyle()) - newStyle->setFontDescription(m_canvas->computedStyle()->fontDescription()); + if (canvas()->computedStyle()) + newStyle->setFontDescription(canvas()->computedStyle()->fontDescription()); // Now map the font property into the style. - CSSStyleSelector* styleSelector = m_canvas->document()->styleSelector(); + CSSStyleSelector* styleSelector = canvas()->document()->styleSelector(); styleSelector->applyPropertyToStyle(CSSPropertyFont, tempDecl->getPropertyCSSValue(CSSPropertyFont).get(), newStyle.get()); state().m_font = newStyle->font(); @@ -1455,8 +1455,8 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo // FIXME: Handle maxWidth. // FIXME: Need to turn off font smoothing. - bool rtl = m_canvas->computedStyle() ? m_canvas->computedStyle()->direction() == RTL : false; - bool override = m_canvas->computedStyle() ? m_canvas->computedStyle()->unicodeBidi() == Override : false; + bool rtl = canvas()->computedStyle() ? canvas()->computedStyle()->direction() == RTL : false; + bool override = canvas()->computedStyle() ? canvas()->computedStyle()->unicodeBidi() == Override : false; unsigned length = text.length(); const UChar* string = text.characters(); @@ -1508,11 +1508,11 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo textRect.inflate(c->strokeThickness() / 2); if (fill) - m_canvas->willDraw(textRect); + canvas()->willDraw(textRect); else { // When stroking text, pointy miters can extend outside of textRect, so we // punt and dirty the whole canvas. - m_canvas->willDraw(FloatRect(0, 0, m_canvas->width(), m_canvas->height())); + canvas()->willDraw(FloatRect(0, 0, canvas()->width(), canvas()->height())); } #if PLATFORM(CG) diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.cpp index 9cca57b..612b4c3 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.cpp +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.cpp @@ -42,12 +42,23 @@ namespace WebCore { -CanvasRenderingContext3D::CanvasRenderingContext3D(HTMLCanvasElement* canvas) - : CanvasRenderingContext(canvas) +PassOwnPtr<CanvasRenderingContext3D> CanvasRenderingContext3D::create(HTMLCanvasElement* canvas) +{ + OwnPtr<GraphicsContext3D> context(GraphicsContext3D::create()); + if (!context) + return 0; + + return new CanvasRenderingContext3D(canvas, context.release()); +} + +CanvasRenderingContext3D::CanvasRenderingContext3D(HTMLCanvasElement* passedCanvas, PassOwnPtr<GraphicsContext3D> context) + : CanvasRenderingContext(passedCanvas) + , m_context(context) , m_needsUpdate(true) , m_markedCanvasDirty(false) { - m_context.reshape(m_canvas->width(), m_canvas->height()); + ASSERT(m_context); + m_context->reshape(canvas()->width(), canvas()->height()); } CanvasRenderingContext3D::~CanvasRenderingContext3D() @@ -58,14 +69,14 @@ CanvasRenderingContext3D::~CanvasRenderingContext3D() void CanvasRenderingContext3D::markContextChanged() { #if USE(ACCELERATED_COMPOSITING) - if (m_canvas->renderBox() && m_canvas->renderBox()->hasLayer()) { - m_canvas->renderBox()->layer()->rendererContentChanged(); + if (canvas()->renderBox() && canvas()->renderBox()->hasLayer()) { + canvas()->renderBox()->layer()->rendererContentChanged(); } else { #endif if (!m_markedCanvasDirty) { // Make sure the canvas's image buffer is allocated. - m_canvas->buffer(); - m_canvas->willDraw(FloatRect(0, 0, m_canvas->width(), m_canvas->height())); + canvas()->buffer(); + canvas()->willDraw(FloatRect(0, 0, canvas()->width(), canvas()->height())); m_markedCanvasDirty = true; } #if USE(ACCELERATED_COMPOSITING) @@ -76,7 +87,7 @@ void CanvasRenderingContext3D::markContextChanged() void CanvasRenderingContext3D::beginPaint() { if (m_markedCanvasDirty) { - m_context.beginPaint(this); + m_context->beginPaint(this); } } @@ -84,7 +95,7 @@ void CanvasRenderingContext3D::endPaint() { if (m_markedCanvasDirty) { m_markedCanvasDirty = false; - m_context.endPaint(); + m_context->endPaint(); } } @@ -92,18 +103,18 @@ void CanvasRenderingContext3D::reshape(int width, int height) { if (m_needsUpdate) { #if USE(ACCELERATED_COMPOSITING) - if (m_canvas->renderBox() && m_canvas->renderBox()->hasLayer()) - m_canvas->renderBox()->layer()->rendererContentChanged(); + if (canvas()->renderBox() && canvas()->renderBox()->hasLayer()) + canvas()->renderBox()->layer()->rendererContentChanged(); #endif m_needsUpdate = false; } - m_context.reshape(width, height); + m_context->reshape(width, height); } int CanvasRenderingContext3D::sizeInBytes(int type, ExceptionCode& ec) { - int result = m_context.sizeInBytes(type); + int result = m_context->sizeInBytes(type); if (result <= 0) { ec = SYNTAX_ERR; } @@ -112,7 +123,7 @@ int CanvasRenderingContext3D::sizeInBytes(int type, ExceptionCode& ec) void CanvasRenderingContext3D::activeTexture(unsigned long texture) { - m_context.activeTexture(texture); + m_context->activeTexture(texture); cleanupAfterGraphicsCall(false); } @@ -120,7 +131,7 @@ void CanvasRenderingContext3D::attachShader(CanvasProgram* program, CanvasShader { if (!program || !shader) return; - m_context.attachShader(program, shader); + m_context->attachShader(program, shader); cleanupAfterGraphicsCall(false); } @@ -128,94 +139,94 @@ void CanvasRenderingContext3D::bindAttribLocation(CanvasProgram* program, unsign { if (!program) return; - m_context.bindAttribLocation(program, index, name); + m_context->bindAttribLocation(program, index, name); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::bindBuffer(unsigned long target, CanvasBuffer* buffer) { - m_context.bindBuffer(target, buffer); + m_context->bindBuffer(target, buffer); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::bindFramebuffer(unsigned long target, CanvasFramebuffer* buffer) { - m_context.bindFramebuffer(target, buffer); + m_context->bindFramebuffer(target, buffer); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::bindRenderbuffer(unsigned long target, CanvasRenderbuffer* renderbuffer) { - m_context.bindRenderbuffer(target, renderbuffer); + m_context->bindRenderbuffer(target, renderbuffer); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::bindTexture(unsigned long target, CanvasTexture* texture) { - m_context.bindTexture(target, texture); + m_context->bindTexture(target, texture); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::blendColor(double red, double green, double blue, double alpha) { - m_context.blendColor(red, green, blue, alpha); + m_context->blendColor(red, green, blue, alpha); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::blendEquation( unsigned long mode ) { - m_context.blendEquation(mode); + m_context->blendEquation(mode); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha) { - m_context.blendEquationSeparate(modeRGB, modeAlpha); + m_context->blendEquationSeparate(modeRGB, modeAlpha); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::blendFunc(unsigned long sfactor, unsigned long dfactor) { - m_context.blendFunc(sfactor, dfactor); + m_context->blendFunc(sfactor, dfactor); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha) { - m_context.blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); + m_context->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::bufferData(unsigned long target, int size, unsigned long usage) { - m_context.bufferData(target, size, usage); + m_context->bufferData(target, size, usage); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::bufferData(unsigned long target, CanvasArray* data, unsigned long usage) { - m_context.bufferData(target, data, usage); + m_context->bufferData(target, data, usage); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::bufferSubData(unsigned long target, long offset, CanvasArray* data) { - m_context.bufferSubData(target, offset, data); + m_context->bufferSubData(target, offset, data); cleanupAfterGraphicsCall(false); } unsigned long CanvasRenderingContext3D::checkFramebufferStatus(unsigned long target) { - return m_context.checkFramebufferStatus(target); + return m_context->checkFramebufferStatus(target); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::clear(unsigned long mask) { - m_context.clear(mask); + m_context->clear(mask); cleanupAfterGraphicsCall(true); } @@ -229,43 +240,43 @@ void CanvasRenderingContext3D::clearColor(double r, double g, double b, double a b = 0; if (isnan(a)) a = 1; - m_context.clearColor(r, g, b, a); + m_context->clearColor(r, g, b, a); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::clearDepth(double depth) { - m_context.clearDepth(depth); + m_context->clearDepth(depth); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::clearStencil(long s) { - m_context.clearStencil(s); + m_context->clearStencil(s); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::colorMask(bool red, bool green, bool blue, bool alpha) { - m_context.colorMask(red, green, blue, alpha); + m_context->colorMask(red, green, blue, alpha); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::compileShader(CanvasShader* shader) { - m_context.compileShader(shader); + m_context->compileShader(shader); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border) { - m_context.copyTexImage2D(target, level, internalformat, x, y, width, height, border); + m_context->copyTexImage2D(target, level, internalformat, x, y, width, height, border); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height) { - m_context.copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); + m_context->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); cleanupAfterGraphicsCall(false); } @@ -319,7 +330,7 @@ PassRefPtr<CanvasShader> CanvasRenderingContext3D::createShader(unsigned long ty void CanvasRenderingContext3D::cullFace(unsigned long mode) { - m_context.cullFace(mode); + m_context->cullFace(mode); cleanupAfterGraphicsCall(false); } @@ -373,19 +384,19 @@ void CanvasRenderingContext3D::deleteTexture(CanvasTexture* texture) void CanvasRenderingContext3D::depthFunc(unsigned long func) { - m_context.depthFunc(func); + m_context->depthFunc(func); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::depthMask(bool flag) { - m_context.depthMask(flag); + m_context->depthMask(flag); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::depthRange(double zNear, double zFar) { - m_context.depthRange(zNear, zFar); + m_context->depthRange(zNear, zFar); cleanupAfterGraphicsCall(false); } @@ -394,58 +405,58 @@ void CanvasRenderingContext3D::detachShader(CanvasProgram* program, CanvasShader if (!program || !shader) return; - m_context.detachShader(program, shader); + m_context->detachShader(program, shader); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::disable(unsigned long cap) { - m_context.disable(cap); + m_context->disable(cap); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::disableVertexAttribArray(unsigned long index) { - m_context.disableVertexAttribArray(index); + m_context->disableVertexAttribArray(index); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::drawArrays(unsigned long mode, long first, long count) { - m_context.drawArrays(mode, first, count); + m_context->drawArrays(mode, first, count); cleanupAfterGraphicsCall(true); } void CanvasRenderingContext3D::drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset) { - m_context.drawElements(mode, count, type, offset); + m_context->drawElements(mode, count, type, offset); cleanupAfterGraphicsCall(true); } void CanvasRenderingContext3D::enable(unsigned long cap) { - m_context.enable(cap); + m_context->enable(cap); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::enableVertexAttribArray(unsigned long index) { - m_context.enableVertexAttribArray(index); + m_context->enableVertexAttribArray(index); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::finish() { - m_context.finish(); + m_context->finish(); cleanupAfterGraphicsCall(true); } void CanvasRenderingContext3D::flush() { - m_context.flush(); + m_context->flush(); cleanupAfterGraphicsCall(true); } @@ -454,7 +465,7 @@ void CanvasRenderingContext3D::framebufferRenderbuffer(unsigned long target, uns if (!buffer) return; - m_context.framebufferRenderbuffer(target, attachment, renderbuffertarget, buffer); + m_context->framebufferRenderbuffer(target, attachment, renderbuffertarget, buffer); cleanupAfterGraphicsCall(false); } @@ -463,26 +474,26 @@ void CanvasRenderingContext3D::framebufferTexture2D(unsigned long target, unsign if (!texture) return; - m_context.framebufferTexture2D(target, attachment, textarget, texture, level); + m_context->framebufferTexture2D(target, attachment, textarget, texture, level); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::frontFace(unsigned long mode) { - m_context.frontFace(mode); + m_context->frontFace(mode); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::generateMipmap(unsigned long target) { - m_context.generateMipmap(target); + m_context->generateMipmap(target); cleanupAfterGraphicsCall(false); } PassRefPtr<CanvasActiveInfo> CanvasRenderingContext3D::getActiveAttrib(CanvasProgram* program, unsigned long index, ExceptionCode& ec) { ActiveInfo info; - if (!program || program->context() != this || !m_context.getActiveAttrib(program, index, info)) { + if (!program || program->context() != this || !m_context->getActiveAttrib(program, index, info)) { ec = INDEX_SIZE_ERR; return 0; } @@ -492,7 +503,7 @@ PassRefPtr<CanvasActiveInfo> CanvasRenderingContext3D::getActiveAttrib(CanvasPro PassRefPtr<CanvasActiveInfo> CanvasRenderingContext3D::getActiveUniform(CanvasProgram* program, unsigned long index, ExceptionCode& ec) { ActiveInfo info; - if (!program || program->context() != this || !m_context.getActiveUniform(program, index, info)) { + if (!program || program->context() != this || !m_context->getActiveUniform(program, index, info)) { ec = INDEX_SIZE_ERR; return 0; } @@ -501,251 +512,251 @@ PassRefPtr<CanvasActiveInfo> CanvasRenderingContext3D::getActiveUniform(CanvasPr int CanvasRenderingContext3D::getAttribLocation(CanvasProgram* program, const String& name) { - return m_context.getAttribLocation(program, name); + return m_context->getAttribLocation(program, name); } bool CanvasRenderingContext3D::getBoolean(unsigned long pname) { - bool result = m_context.getBoolean(pname); + bool result = m_context->getBoolean(pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasUnsignedByteArray> CanvasRenderingContext3D::getBooleanv(unsigned long pname) { - RefPtr<CanvasUnsignedByteArray> array = m_context.getBooleanv(pname); + RefPtr<CanvasUnsignedByteArray> array = m_context->getBooleanv(pname); cleanupAfterGraphicsCall(false); return array; } int CanvasRenderingContext3D::getBufferParameteri(unsigned long target, unsigned long pname) { - int result = m_context.getBufferParameteri(target, pname); + int result = m_context->getBufferParameteri(target, pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasIntArray> CanvasRenderingContext3D::getBufferParameteriv(unsigned long target, unsigned long pname) { - RefPtr<CanvasIntArray> array = m_context.getBufferParameteriv(target, pname); + RefPtr<CanvasIntArray> array = m_context->getBufferParameteriv(target, pname); cleanupAfterGraphicsCall(false); return array; } unsigned long CanvasRenderingContext3D::getError() { - return m_context.getError(); + return m_context->getError(); } float CanvasRenderingContext3D::getFloat(unsigned long pname) { - float result = m_context.getFloat(pname); + float result = m_context->getFloat(pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasFloatArray> CanvasRenderingContext3D::getFloatv(unsigned long pname) { - RefPtr<CanvasFloatArray> array = m_context.getFloatv(pname); + RefPtr<CanvasFloatArray> array = m_context->getFloatv(pname); cleanupAfterGraphicsCall(false); return array; } int CanvasRenderingContext3D::getFramebufferAttachmentParameteri(unsigned long target, unsigned long attachment, unsigned long pname) { - int result = m_context.getFramebufferAttachmentParameteri(target, attachment, pname); + int result = m_context->getFramebufferAttachmentParameteri(target, attachment, pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasIntArray> CanvasRenderingContext3D::getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname) { - RefPtr<CanvasIntArray> array = m_context.getFramebufferAttachmentParameteriv(target, attachment, pname); + RefPtr<CanvasIntArray> array = m_context->getFramebufferAttachmentParameteriv(target, attachment, pname); cleanupAfterGraphicsCall(false); return array; } int CanvasRenderingContext3D::getInteger(unsigned long pname) { - float result = m_context.getInteger(pname); + float result = m_context->getInteger(pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasIntArray> CanvasRenderingContext3D::getIntegerv(unsigned long pname) { - RefPtr<CanvasIntArray> array = m_context.getIntegerv(pname); + RefPtr<CanvasIntArray> array = m_context->getIntegerv(pname); cleanupAfterGraphicsCall(false); return array; } int CanvasRenderingContext3D::getProgrami(CanvasProgram* program, unsigned long pname) { - int result = m_context.getProgrami(program, pname); + int result = m_context->getProgrami(program, pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasIntArray> CanvasRenderingContext3D::getProgramiv(CanvasProgram* program, unsigned long pname) { - RefPtr<CanvasIntArray> array = m_context.getProgramiv(program, pname); + RefPtr<CanvasIntArray> array = m_context->getProgramiv(program, pname); cleanupAfterGraphicsCall(false); return array; } String CanvasRenderingContext3D::getProgramInfoLog(CanvasProgram* program) { - String s = m_context.getProgramInfoLog(program); + String s = m_context->getProgramInfoLog(program); cleanupAfterGraphicsCall(false); return s; } int CanvasRenderingContext3D::getRenderbufferParameteri(unsigned long target, unsigned long pname) { - int result = m_context.getRenderbufferParameteri(target, pname); + int result = m_context->getRenderbufferParameteri(target, pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasIntArray> CanvasRenderingContext3D::getRenderbufferParameteriv(unsigned long target, unsigned long pname) { - RefPtr<CanvasIntArray> array = m_context.getRenderbufferParameteriv(target, pname); + RefPtr<CanvasIntArray> array = m_context->getRenderbufferParameteriv(target, pname); cleanupAfterGraphicsCall(false); return array; } int CanvasRenderingContext3D::getShaderi(CanvasShader* shader, unsigned long pname) { - int result = m_context.getShaderi(shader, pname); + int result = m_context->getShaderi(shader, pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasIntArray> CanvasRenderingContext3D::getShaderiv(CanvasShader* shader, unsigned long pname) { - RefPtr<CanvasIntArray> array = m_context.getShaderiv(shader, pname); + RefPtr<CanvasIntArray> array = m_context->getShaderiv(shader, pname); cleanupAfterGraphicsCall(false); return array; } String CanvasRenderingContext3D::getShaderInfoLog(CanvasShader* shader) { - String s = m_context.getShaderInfoLog(shader); + String s = m_context->getShaderInfoLog(shader); cleanupAfterGraphicsCall(false); return s; } String CanvasRenderingContext3D::getShaderSource(CanvasShader* shader) { - String s = m_context.getShaderSource(shader); + String s = m_context->getShaderSource(shader); cleanupAfterGraphicsCall(false); return s; } String CanvasRenderingContext3D::getString(unsigned long name) { - return m_context.getString(name); + return m_context->getString(name); } float CanvasRenderingContext3D::getTexParameterf(unsigned long target, unsigned long pname) { - float result = m_context.getTexParameterf(target, pname); + float result = m_context->getTexParameterf(target, pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasFloatArray> CanvasRenderingContext3D::getTexParameterfv(unsigned long target, unsigned long pname) { - RefPtr<CanvasFloatArray> array = m_context.getTexParameterfv(target, pname); + RefPtr<CanvasFloatArray> array = m_context->getTexParameterfv(target, pname); cleanupAfterGraphicsCall(false); return array; } int CanvasRenderingContext3D::getTexParameteri(unsigned long target, unsigned long pname) { - int result = m_context.getTexParameteri(target, pname); + int result = m_context->getTexParameteri(target, pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasIntArray> CanvasRenderingContext3D::getTexParameteriv(unsigned long target, unsigned long pname) { - RefPtr<CanvasIntArray> array = m_context.getTexParameteriv(target, pname); + RefPtr<CanvasIntArray> array = m_context->getTexParameteriv(target, pname); cleanupAfterGraphicsCall(false); return array; } float CanvasRenderingContext3D::getUniformf(CanvasProgram* program, long location) { - float result = m_context.getUniformf(program, location); + float result = m_context->getUniformf(program, location); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasFloatArray> CanvasRenderingContext3D::getUniformfv(CanvasProgram* program, long location) { - RefPtr<CanvasFloatArray> array = m_context.getUniformfv(program, location); + RefPtr<CanvasFloatArray> array = m_context->getUniformfv(program, location); cleanupAfterGraphicsCall(false); return array; } long CanvasRenderingContext3D::getUniformi(CanvasProgram* program, long location) { - long result = m_context.getUniformi(program, location); + long result = m_context->getUniformi(program, location); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasIntArray> CanvasRenderingContext3D::getUniformiv(CanvasProgram* program, long location) { - RefPtr<CanvasIntArray> array = m_context.getUniformiv(program, location); + RefPtr<CanvasIntArray> array = m_context->getUniformiv(program, location); cleanupAfterGraphicsCall(false); return array; } long CanvasRenderingContext3D::getUniformLocation(CanvasProgram* program, const String& name) { - return m_context.getUniformLocation(program, name); + return m_context->getUniformLocation(program, name); } float CanvasRenderingContext3D::getVertexAttribf(unsigned long index, unsigned long pname) { - float result = m_context.getVertexAttribf(index, pname); + float result = m_context->getVertexAttribf(index, pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasFloatArray> CanvasRenderingContext3D::getVertexAttribfv(unsigned long index, unsigned long pname) { - RefPtr<CanvasFloatArray> array = m_context.getVertexAttribfv(index, pname); + RefPtr<CanvasFloatArray> array = m_context->getVertexAttribfv(index, pname); cleanupAfterGraphicsCall(false); return array; } long CanvasRenderingContext3D::getVertexAttribi(unsigned long index, unsigned long pname) { - long result = m_context.getVertexAttribi(index, pname); + long result = m_context->getVertexAttribi(index, pname); cleanupAfterGraphicsCall(false); return result; } PassRefPtr<CanvasIntArray> CanvasRenderingContext3D::getVertexAttribiv(unsigned long index, unsigned long pname) { - RefPtr<CanvasIntArray> array = m_context.getVertexAttribiv(index, pname); + RefPtr<CanvasIntArray> array = m_context->getVertexAttribiv(index, pname); cleanupAfterGraphicsCall(false); return array; } long CanvasRenderingContext3D::getVertexAttribOffset(unsigned long index, unsigned long pname) { - long result = m_context.getVertexAttribOffset(index, pname); + long result = m_context->getVertexAttribOffset(index, pname); cleanupAfterGraphicsCall(false); return result; } void CanvasRenderingContext3D::hint(unsigned long target, unsigned long mode) { - m_context.hint(target, mode); + m_context->hint(target, mode); cleanupAfterGraphicsCall(false); } @@ -754,42 +765,42 @@ bool CanvasRenderingContext3D::isBuffer(CanvasBuffer* buffer) if (!buffer) return false; - return m_context.isBuffer(buffer); + return m_context->isBuffer(buffer); } bool CanvasRenderingContext3D::isEnabled(unsigned long cap) { - return m_context.isEnabled(cap); + return m_context->isEnabled(cap); } bool CanvasRenderingContext3D::isFramebuffer(CanvasFramebuffer* framebuffer) { - return m_context.isFramebuffer(framebuffer); + return m_context->isFramebuffer(framebuffer); } bool CanvasRenderingContext3D::isProgram(CanvasProgram* program) { - return m_context.isProgram(program); + return m_context->isProgram(program); } bool CanvasRenderingContext3D::isRenderbuffer(CanvasRenderbuffer* renderbuffer) { - return m_context.isRenderbuffer(renderbuffer); + return m_context->isRenderbuffer(renderbuffer); } bool CanvasRenderingContext3D::isShader(CanvasShader* shader) { - return m_context.isShader(shader); + return m_context->isShader(shader); } bool CanvasRenderingContext3D::isTexture(CanvasTexture* texture) { - return m_context.isTexture(texture); + return m_context->isTexture(texture); } void CanvasRenderingContext3D::lineWidth(double width) { - m_context.lineWidth((float) width); + m_context->lineWidth((float) width); cleanupAfterGraphicsCall(false); } @@ -798,92 +809,92 @@ void CanvasRenderingContext3D::linkProgram(CanvasProgram* program) if (!program) return; - m_context.linkProgram(program); + m_context->linkProgram(program); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::pixelStorei(unsigned long pname, long param) { - m_context.pixelStorei(pname, param); + m_context->pixelStorei(pname, param); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::polygonOffset(double factor, double units) { - m_context.polygonOffset((float) factor, (float) units); + m_context->polygonOffset((float) factor, (float) units); cleanupAfterGraphicsCall(false); } PassRefPtr<CanvasArray> CanvasRenderingContext3D::readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type) { - RefPtr<CanvasArray> array = m_context.readPixels(x, y, width, height, format, type); + RefPtr<CanvasArray> array = m_context->readPixels(x, y, width, height, format, type); cleanupAfterGraphicsCall(false); return array; } void CanvasRenderingContext3D::releaseShaderCompiler() { - m_context.releaseShaderCompiler(); + m_context->releaseShaderCompiler(); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height) { - m_context.renderbufferStorage(target, internalformat, width, height); + m_context->renderbufferStorage(target, internalformat, width, height); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::sampleCoverage(double value, bool invert) { - m_context.sampleCoverage((float) value, invert); + m_context->sampleCoverage((float) value, invert); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::scissor(long x, long y, unsigned long width, unsigned long height) { - m_context.scissor(x, y, width, height); + m_context->scissor(x, y, width, height); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::shaderSource(CanvasShader* shader, const String& string) { - m_context.shaderSource(shader, string); + m_context->shaderSource(shader, string); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::stencilFunc(unsigned long func, long ref, unsigned long mask) { - m_context.stencilFunc(func, ref, mask); + m_context->stencilFunc(func, ref, mask); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask) { - m_context.stencilFuncSeparate(face, func, ref, mask); + m_context->stencilFuncSeparate(face, func, ref, mask); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::stencilMask(unsigned long mask) { - m_context.stencilMask(mask); + m_context->stencilMask(mask); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::stencilMaskSeparate(unsigned long face, unsigned long mask) { - m_context.stencilMaskSeparate(face, mask); + m_context->stencilMaskSeparate(face, mask); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass) { - m_context.stencilOp(fail, zfail, zpass); + m_context->stencilOp(fail, zfail, zpass); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass) { - m_context.stencilOpSeparate(face, fail, zfail, zpass); + m_context->stencilOpSeparate(face, fail, zfail, zpass); cleanupAfterGraphicsCall(false); } @@ -893,7 +904,7 @@ void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, unsig { // FIXME: For now we ignore any errors returned ec = 0; - m_context.texImage2D(target, level, internalformat, width, height, + m_context->texImage2D(target, level, internalformat, width, height, border, format, type, pixels); cleanupAfterGraphicsCall(false); } @@ -904,7 +915,7 @@ void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, unsig { // FIXME: For now we ignore any errors returned ec = 0; - m_context.texImage2D(target, level, internalformat, width, height, + m_context->texImage2D(target, level, internalformat, width, height, border, format, type, pixels); cleanupAfterGraphicsCall(false); } @@ -914,7 +925,7 @@ void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, HTMLI { // FIXME: For now we ignore any errors returned ec = 0; - m_context.texImage2D(target, level, image, flipY, premultiplyAlpha); + m_context->texImage2D(target, level, image, flipY, premultiplyAlpha); cleanupAfterGraphicsCall(false); } @@ -923,7 +934,7 @@ void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, HTMLC { // FIXME: For now we ignore any errors returned ec = 0; - m_context.texImage2D(target, level, canvas, flipY, premultiplyAlpha); + m_context->texImage2D(target, level, canvas, flipY, premultiplyAlpha); cleanupAfterGraphicsCall(false); } @@ -932,19 +943,19 @@ void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, HTMLV { // FIXME: For now we ignore any errors returned ec = 0; - m_context.texImage2D(target, level, video, flipY, premultiplyAlpha); + m_context->texImage2D(target, level, video, flipY, premultiplyAlpha); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::texParameterf(unsigned target, unsigned pname, float param) { - m_context.texParameterf(target, pname, param); + m_context->texParameterf(target, pname, param); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::texParameteri(unsigned target, unsigned pname, int param) { - m_context.texParameteri(target, pname, param); + m_context->texParameteri(target, pname, param); cleanupAfterGraphicsCall(false); } @@ -954,7 +965,7 @@ void CanvasRenderingContext3D::texSubImage2D(unsigned target, unsigned level, un { // FIXME: For now we ignore any errors returned ec = 0; - m_context.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); + m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); cleanupAfterGraphicsCall(false); } @@ -964,7 +975,7 @@ void CanvasRenderingContext3D::texSubImage2D(unsigned target, unsigned level, un { // FIXME: For now we ignore any errors returned ec = 0; - m_context.texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); + m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); cleanupAfterGraphicsCall(false); } @@ -974,7 +985,7 @@ void CanvasRenderingContext3D::texSubImage2D(unsigned target, unsigned level, un { // FIXME: For now we ignore any errors returned ec = 0; - m_context.texSubImage2D(target, level, xoffset, yoffset, width, height, image, flipY, premultiplyAlpha); + m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, image, flipY, premultiplyAlpha); cleanupAfterGraphicsCall(false); } @@ -984,7 +995,7 @@ void CanvasRenderingContext3D::texSubImage2D(unsigned target, unsigned level, un { // FIXME: For now we ignore any errors returned ec = 0; - m_context.texSubImage2D(target, level, xoffset, yoffset, width, height, canvas, flipY, premultiplyAlpha); + m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, canvas, flipY, premultiplyAlpha); cleanupAfterGraphicsCall(false); } @@ -994,13 +1005,13 @@ void CanvasRenderingContext3D::texSubImage2D(unsigned target, unsigned level, un { // FIXME: For now we ignore any errors returned ec = 0; - m_context.texSubImage2D(target, level, xoffset, yoffset, width, height, video, flipY, premultiplyAlpha); + m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, video, flipY, premultiplyAlpha); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::uniform1f(long location, float x) { - m_context.uniform1f(location, x); + m_context->uniform1f(location, x); cleanupAfterGraphicsCall(false); } @@ -1010,7 +1021,7 @@ void CanvasRenderingContext3D::uniform1fv(long location, CanvasFloatArray* v) if (!v) return; - m_context.uniform1fv(location, v->data(), v->length()); + m_context->uniform1fv(location, v->data(), v->length()); cleanupAfterGraphicsCall(false); } @@ -1020,13 +1031,13 @@ void CanvasRenderingContext3D::uniform1fv(long location, float* v, int size) if (!v) return; - m_context.uniform1fv(location, v, size); + m_context->uniform1fv(location, v, size); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::uniform1i(long location, int x) { - m_context.uniform1i(location, x); + m_context->uniform1i(location, x); cleanupAfterGraphicsCall(false); } @@ -1036,7 +1047,7 @@ void CanvasRenderingContext3D::uniform1iv(long location, CanvasIntArray* v) if (!v) return; - m_context.uniform1iv(location, v->data(), v->length()); + m_context->uniform1iv(location, v->data(), v->length()); cleanupAfterGraphicsCall(false); } @@ -1046,13 +1057,13 @@ void CanvasRenderingContext3D::uniform1iv(long location, int* v, int size) if (!v) return; - m_context.uniform1iv(location, v, size); + m_context->uniform1iv(location, v, size); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::uniform2f(long location, float x, float y) { - m_context.uniform2f(location, x, y); + m_context->uniform2f(location, x, y); cleanupAfterGraphicsCall(false); } @@ -1063,7 +1074,7 @@ void CanvasRenderingContext3D::uniform2fv(long location, CanvasFloatArray* v) return; // FIXME: length needs to be a multiple of 2 - m_context.uniform2fv(location, v->data(), v->length() / 2); + m_context->uniform2fv(location, v->data(), v->length() / 2); cleanupAfterGraphicsCall(false); } @@ -1074,13 +1085,13 @@ void CanvasRenderingContext3D::uniform2fv(long location, float* v, int size) return; // FIXME: length needs to be a multiple of 2 - m_context.uniform2fv(location, v, size / 2); + m_context->uniform2fv(location, v, size / 2); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::uniform2i(long location, int x, int y) { - m_context.uniform2i(location, x, y); + m_context->uniform2i(location, x, y); cleanupAfterGraphicsCall(false); } @@ -1091,7 +1102,7 @@ void CanvasRenderingContext3D::uniform2iv(long location, CanvasIntArray* v) return; // FIXME: length needs to be a multiple of 2 - m_context.uniform2iv(location, v->data(), v->length() / 2); + m_context->uniform2iv(location, v->data(), v->length() / 2); cleanupAfterGraphicsCall(false); } @@ -1102,13 +1113,13 @@ void CanvasRenderingContext3D::uniform2iv(long location, int* v, int size) return; // FIXME: length needs to be a multiple of 2 - m_context.uniform2iv(location, v, size / 2); + m_context->uniform2iv(location, v, size / 2); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::uniform3f(long location, float x, float y, float z) { - m_context.uniform3f(location, x, y, z); + m_context->uniform3f(location, x, y, z); cleanupAfterGraphicsCall(false); } @@ -1119,7 +1130,7 @@ void CanvasRenderingContext3D::uniform3fv(long location, CanvasFloatArray* v) return; // FIXME: length needs to be a multiple of 3 - m_context.uniform3fv(location, v->data(), v->length() / 3); + m_context->uniform3fv(location, v->data(), v->length() / 3); cleanupAfterGraphicsCall(false); } @@ -1130,13 +1141,13 @@ void CanvasRenderingContext3D::uniform3fv(long location, float* v, int size) return; // FIXME: length needs to be a multiple of 3 - m_context.uniform3fv(location, v, size / 3); + m_context->uniform3fv(location, v, size / 3); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::uniform3i(long location, int x, int y, int z) { - m_context.uniform3i(location, x, y, z); + m_context->uniform3i(location, x, y, z); cleanupAfterGraphicsCall(false); } @@ -1147,7 +1158,7 @@ void CanvasRenderingContext3D::uniform3iv(long location, CanvasIntArray* v) return; // FIXME: length needs to be a multiple of 3 - m_context.uniform3iv(location, v->data(), v->length() / 3); + m_context->uniform3iv(location, v->data(), v->length() / 3); cleanupAfterGraphicsCall(false); } @@ -1158,13 +1169,13 @@ void CanvasRenderingContext3D::uniform3iv(long location, int* v, int size) return; // FIXME: length needs to be a multiple of 3 - m_context.uniform3iv(location, v, size / 3); + m_context->uniform3iv(location, v, size / 3); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::uniform4f(long location, float x, float y, float z, float w) { - m_context.uniform4f(location, x, y, z, w); + m_context->uniform4f(location, x, y, z, w); cleanupAfterGraphicsCall(false); } @@ -1175,7 +1186,7 @@ void CanvasRenderingContext3D::uniform4fv(long location, CanvasFloatArray* v) return; // FIXME: length needs to be a multiple of 4 - m_context.uniform4fv(location, v->data(), v->length() / 4); + m_context->uniform4fv(location, v->data(), v->length() / 4); cleanupAfterGraphicsCall(false); } @@ -1186,13 +1197,13 @@ void CanvasRenderingContext3D::uniform4fv(long location, float* v, int size) return; // FIXME: length needs to be a multiple of 4 - m_context.uniform4fv(location, v, size / 4); + m_context->uniform4fv(location, v, size / 4); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::uniform4i(long location, int x, int y, int z, int w) { - m_context.uniform4i(location, x, y, z, w); + m_context->uniform4i(location, x, y, z, w); cleanupAfterGraphicsCall(false); } @@ -1203,7 +1214,7 @@ void CanvasRenderingContext3D::uniform4iv(long location, CanvasIntArray* v) return; // FIXME: length needs to be a multiple of 4 - m_context.uniform4iv(location, v->data(), v->length() / 4); + m_context->uniform4iv(location, v->data(), v->length() / 4); cleanupAfterGraphicsCall(false); } @@ -1214,7 +1225,7 @@ void CanvasRenderingContext3D::uniform4iv(long location, int* v, int size) return; // FIXME: length needs to be a multiple of 4 - m_context.uniform4iv(location, v, size / 4); + m_context->uniform4iv(location, v, size / 4); cleanupAfterGraphicsCall(false); } @@ -1225,7 +1236,7 @@ void CanvasRenderingContext3D::uniformMatrix2fv(long location, bool transpose, C return; // FIXME: length needs to be a multiple of 4 - m_context.uniformMatrix2fv(location, transpose, v->data(), v->length() / 4); + m_context->uniformMatrix2fv(location, transpose, v->data(), v->length() / 4); cleanupAfterGraphicsCall(false); } @@ -1236,7 +1247,7 @@ void CanvasRenderingContext3D::uniformMatrix2fv(long location, bool transpose, f return; // FIXME: length needs to be a multiple of 4 - m_context.uniformMatrix2fv(location, transpose, v, size / 4); + m_context->uniformMatrix2fv(location, transpose, v, size / 4); cleanupAfterGraphicsCall(false); } @@ -1247,7 +1258,7 @@ void CanvasRenderingContext3D::uniformMatrix3fv(long location, bool transpose, C return; // FIXME: length needs to be a multiple of 9 - m_context.uniformMatrix3fv(location, transpose, v->data(), v->length() / 9); + m_context->uniformMatrix3fv(location, transpose, v->data(), v->length() / 9); cleanupAfterGraphicsCall(false); } @@ -1258,7 +1269,7 @@ void CanvasRenderingContext3D::uniformMatrix3fv(long location, bool transpose, f return; // FIXME: length needs to be a multiple of 9 - m_context.uniformMatrix3fv(location, transpose, v, size / 9); + m_context->uniformMatrix3fv(location, transpose, v, size / 9); cleanupAfterGraphicsCall(false); } @@ -1269,7 +1280,7 @@ void CanvasRenderingContext3D::uniformMatrix4fv(long location, bool transpose, C return; // FIXME: length needs to be a multiple of 16 - m_context.uniformMatrix4fv(location, transpose, v->data(), v->length() / 16); + m_context->uniformMatrix4fv(location, transpose, v->data(), v->length() / 16); cleanupAfterGraphicsCall(false); } @@ -1280,32 +1291,32 @@ void CanvasRenderingContext3D::uniformMatrix4fv(long location, bool transpose, f return; // FIXME: length needs to be a multiple of 16 - m_context.uniformMatrix4fv(location, transpose, v, size / 16); + m_context->uniformMatrix4fv(location, transpose, v, size / 16); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::useProgram(CanvasProgram* program) { - m_context.useProgram(program); + m_context->useProgram(program); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::validateProgram(CanvasProgram* program) { - m_context.validateProgram(program); + m_context->validateProgram(program); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::vertexAttrib1f(unsigned long indx, float v0) { - m_context.vertexAttrib1f(indx, v0); + m_context->vertexAttrib1f(indx, v0); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::vertexAttrib1fv(unsigned long indx, CanvasFloatArray* v) { // FIXME: Need to make sure array is big enough for attribute being set - m_context.vertexAttrib1fv(indx, v->data()); + m_context->vertexAttrib1fv(indx, v->data()); cleanupAfterGraphicsCall(false); } @@ -1314,20 +1325,20 @@ void CanvasRenderingContext3D::vertexAttrib1fv(unsigned long indx, float* v, int // FIXME: Need to make sure array is big enough for attribute being set UNUSED_PARAM(size); - m_context.vertexAttrib1fv(indx, v); + m_context->vertexAttrib1fv(indx, v); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::vertexAttrib2f(unsigned long indx, float v0, float v1) { - m_context.vertexAttrib2f(indx, v0, v1); + m_context->vertexAttrib2f(indx, v0, v1); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::vertexAttrib2fv(unsigned long indx, CanvasFloatArray* v) { // FIXME: Need to make sure array is big enough for attribute being set - m_context.vertexAttrib2fv(indx, v->data()); + m_context->vertexAttrib2fv(indx, v->data()); cleanupAfterGraphicsCall(false); } @@ -1336,20 +1347,20 @@ void CanvasRenderingContext3D::vertexAttrib2fv(unsigned long indx, float* v, int // FIXME: Need to make sure array is big enough for attribute being set UNUSED_PARAM(size); - m_context.vertexAttrib2fv(indx, v); + m_context->vertexAttrib2fv(indx, v); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::vertexAttrib3f(unsigned long indx, float v0, float v1, float v2) { - m_context.vertexAttrib3f(indx, v0, v1, v2); + m_context->vertexAttrib3f(indx, v0, v1, v2); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::vertexAttrib3fv(unsigned long indx, CanvasFloatArray* v) { // FIXME: Need to make sure array is big enough for attribute being set - m_context.vertexAttrib3fv(indx, v->data()); + m_context->vertexAttrib3fv(indx, v->data()); cleanupAfterGraphicsCall(false); } @@ -1358,20 +1369,20 @@ void CanvasRenderingContext3D::vertexAttrib3fv(unsigned long indx, float* v, int // FIXME: Need to make sure array is big enough for attribute being set UNUSED_PARAM(size); - m_context.vertexAttrib3fv(indx, v); + m_context->vertexAttrib3fv(indx, v); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::vertexAttrib4f(unsigned long indx, float v0, float v1, float v2, float v3) { - m_context.vertexAttrib4f(indx, v0, v1, v2, v3); + m_context->vertexAttrib4f(indx, v0, v1, v2, v3); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::vertexAttrib4fv(unsigned long indx, CanvasFloatArray* v) { // FIXME: Need to make sure array is big enough for attribute being set - m_context.vertexAttrib4fv(indx, v->data()); + m_context->vertexAttrib4fv(indx, v->data()); cleanupAfterGraphicsCall(false); } @@ -1380,13 +1391,13 @@ void CanvasRenderingContext3D::vertexAttrib4fv(unsigned long indx, float* v, int // FIXME: Need to make sure array is big enough for attribute being set UNUSED_PARAM(size); - m_context.vertexAttrib4fv(indx, v); + m_context->vertexAttrib4fv(indx, v); cleanupAfterGraphicsCall(false); } void CanvasRenderingContext3D::vertexAttribPointer(unsigned long indx, long size, unsigned long type, bool normalized, unsigned long stride, unsigned long offset) { - m_context.vertexAttribPointer(indx, size, type, normalized, stride, offset); + m_context->vertexAttribPointer(indx, size, type, normalized, stride, offset); cleanupAfterGraphicsCall(false); } @@ -1400,7 +1411,7 @@ void CanvasRenderingContext3D::viewport(long x, long y, unsigned long width, uns width = 100; if (isnan(height)) height = 100; - m_context.viewport(x, y, width, height); + m_context->viewport(x, y, width, height); cleanupAfterGraphicsCall(false); } diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.h b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.h index 526281b..70d9b95 100644 --- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.h +++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext3D.h @@ -51,8 +51,8 @@ class WebKitCSSMatrix; class CanvasRenderingContext3D : public CanvasRenderingContext { public: - CanvasRenderingContext3D(HTMLCanvasElement*); - ~CanvasRenderingContext3D(); + static PassOwnPtr<CanvasRenderingContext3D> create(HTMLCanvasElement*); + virtual ~CanvasRenderingContext3D(); virtual bool is3d() const { return true; } @@ -288,7 +288,7 @@ class WebKitCSSMatrix; void viewport(long x, long y, unsigned long width, unsigned long height); - GraphicsContext3D* graphicsContext3D() { return &m_context; } + GraphicsContext3D* graphicsContext3D() const { return m_context.get(); } void reshape(int width, int height); @@ -300,18 +300,21 @@ class WebKitCSSMatrix; private: friend class CanvasObject; + + CanvasRenderingContext3D(HTMLCanvasElement*, PassOwnPtr<GraphicsContext3D>); + void addObject(CanvasObject*); void detachAndRemoveAllObjects(); void markContextChanged(); void cleanupAfterGraphicsCall(bool changed) { - m_context.checkError(); + m_context->checkError(); if (changed) markContextChanged(); } - GraphicsContext3D m_context; + OwnPtr<GraphicsContext3D> m_context; bool m_needsUpdate; bool m_markedCanvasDirty; // FIXME: I think this is broken -- it does not increment any |