Changeset 61913 in webkit


Ignore:
Timestamp:
Jun 25, 2010 4:14:00 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-06-25 Zhenyao Mo <zmo@google.com>

Reviewed by Dimitri Glazkov.

getParameter(COLOR_WRITEMASK) needs to return Array
https://bugs.webkit.org/show_bug.cgi?id=40437

  • bindings/js/JSWebGLRenderingContextCustom.cpp: Handling bool array. (WebCore::toJS):
  • bindings/v8/custom/V8WebGLRenderingContextCustom.cpp: Handling bool array. (WebCore::toV8Object):
  • html/canvas/WebGLGetInfo.cpp: Handling bool array. (WebCore::WebGLGetInfo::WebGLGetInfo): (WebCore::WebGLGetInfo::getBoolArray):
  • html/canvas/WebGLGetInfo.h: Handling bool array. (WebCore::WebGLGetInfo::):
  • html/canvas/WebGLRenderingContext.cpp: Handling bool array. (WebCore::WebGLRenderingContext::getParameter): (WebCore::WebGLRenderingContext::getBooleanArrayParameter):
  • html/canvas/WebGLRenderingContext.h: Handling bool array.
Location:
trunk/WebCore
Files:
15 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/Android.mk

    r61818 r61913  
    114114        dom/ContainerNode.cpp \
    115115        dom/DOMImplementation.cpp \
    116         dom/DOMStringList.cpp \
     116        dom/DOMStringList.cpp \
    117117        dom/Document.cpp \
    118118        dom/DocumentFragment.cpp \
     119        dom/DocumentParser.cpp \
    119120        dom/DocumentType.cpp \
    120121        dom/DynamicNodeList.cpp \
  • trunk/WebCore/CMakeLists.txt

    r61818 r61913  
    774774    dom/Document.cpp
    775775    dom/DocumentFragment.cpp
     776    dom/DocumentParser.cpp
    776777    dom/DocumentType.cpp
    777778    dom/DynamicNodeList.cpp
  • trunk/WebCore/ChangeLog

    r61910 r61913  
    4747        * rendering/RenderThemeChromiumLinux.cpp: improve stock colors to get
    4848        better contrast and integration with stock chrome theme
     49
     502010-06-25  Eric Seidel  <eric@webkit.org>
     51
     52        Reviewed by Adam Barth.
     53
     54        Move decoding into DocumentParser to further simplify RawDataDocumentParser and DocumentWriter
     55        https://bugs.webkit.org/show_bug.cgi?id=41202
     56
     57        The silly thing about this patch is that none of the
     58        RawDataDocumentParser subclasses actually use any of the
     59        data passed to them via appendBytes.
     60
     61        This makes the relationship between DocumentWriter and
     62        DocumentParser slightly more confusing, however I think this
     63        DocumentParser API is slightly nicer.
     64
     65        Next step is to split DecodedDataDocumentParser out from
     66        DocumentParser, and then the base DocumentParser won't know
     67        anything about decoding or SegmentedString.
     68
     69        No functional change, thus no tests.
     70
     71        * WebCore.xcodeproj/project.pbxproj:
     72        * dom/DocumentParser.h:
     73        * dom/RawDataDocumentParser.h:
     74        * loader/DocumentWriter.cpp:
     75        (WebCore::DocumentWriter::replaceDocument):
     76        (WebCore::DocumentWriter::createDecoderIfNeeded):
     77        (WebCore::DocumentWriter::reportDataRecieved):
     78        (WebCore::DocumentWriter::addData):
     79        * loader/DocumentWriter.h:
     80        * loader/ImageDocument.cpp:
     81        (WebCore::ImageDocumentParser::appendBytes):
     82        * loader/MediaDocument.cpp:
     83        (WebCore::MediaDocumentParser::appendBytes):
     84        * loader/PluginDocument.cpp:
     85        (WebCore::PluginDocumentParser::appendBytes):
     86        * loader/SinkDocument.cpp:
     87        (WebCore::SinkDocumentParser::SinkDocumentParser):
     88        (WebCore::SinkDocumentParser::appendBytes):
     89        (WebCore::SinkDocument::createParser):
    4990
    50912010-06-25  Eric Seidel  <eric@webkit.org>
  • trunk/WebCore/GNUmakefile.am

    r61818 r61913  
    780780        WebCore/dom/DeviceOrientationEvent.h \
    781781        WebCore/dom/Document.cpp \
     782        WebCore/dom/DocumentParser.cpp \
    782783        WebCore/dom/Document.h \
    783784        WebCore/dom/DocumentFragment.cpp \
  • trunk/WebCore/WebCore.gypi

    r61789 r61913  
    11111111            'dom/DocumentFragment.h',
    11121112            'dom/DocumentMarker.h',
     1113            'dom/DocumentParser.cpp',
     1114            'dom/DocumentParser.h',
    11131115            'dom/DocumentType.cpp',
    11141116            'dom/DocumentType.h',
     
    12321234            'dom/TouchList.cpp',
    12331235            'dom/TouchList.h',
    1234             'dom/DocumentParser.h',
    12351236            'dom/TransformSourceLibxslt.cpp',
    12361237            'dom/TransformSource.h',
  • trunk/WebCore/WebCore.pro

    r61863 r61913  
    476476    dom/Document.cpp \
    477477    dom/DocumentFragment.cpp \
     478    dom/DocumentParser.cpp \
    478479    dom/DocumentType.cpp \
    479480    dom/DOMImplementation.cpp \
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r61818 r61913  
    30533053                A8A909AC0CBCD6B50029B807 /* RenderSVGTransformableContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A909AA0CBCD6B50029B807 /* RenderSVGTransformableContainer.h */; };
    30543054                A8A909AD0CBCD6B50029B807 /* RenderSVGTransformableContainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A909AB0CBCD6B50029B807 /* RenderSVGTransformableContainer.cpp */; };
     3055                A8C2280E11D4A59700D5A7D3 /* DocumentParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C2280D11D4A59700D5A7D3 /* DocumentParser.cpp */; };
    30553056                A8C4A7FD09D563270003AC8D /* StyledElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C4A7EB09D563270003AC8D /* StyledElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
    30563057                A8C4A7FE09D563270003AC8D /* StyledElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C4A7EC09D563270003AC8D /* StyledElement.cpp */; };
     
    85358536                A8A909AA0CBCD6B50029B807 /* RenderSVGTransformableContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGTransformableContainer.h; sourceTree = "<group>"; };
    85368537                A8A909AB0CBCD6B50029B807 /* RenderSVGTransformableContainer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGTransformableContainer.cpp; sourceTree = "<group>"; };
     8538                A8C2280D11D4A59700D5A7D3 /* DocumentParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentParser.cpp; sourceTree = "<group>"; };
    85378539                A8C4A7EB09D563270003AC8D /* StyledElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = StyledElement.h; sourceTree = "<group>"; };
    85388540                A8C4A7EC09D563270003AC8D /* StyledElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = StyledElement.cpp; sourceTree = "<group>"; };
     
    1662416626                        isa = PBXGroup;
    1662516627                        children = (
    16626                                 A84D827B11D333ED00972990 /* RawDataDocumentParser.h */,
    1662716628                                E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */,
    1662816629                                E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */,
     
    1669216693                                1A494ED50A123F1A00FDAFC1 /* DocumentFragment.idl */,
    1669316694                                ED2BA83B09A24B91006C0AC4 /* DocumentMarker.h */,
     16695                                A8C2280D11D4A59700D5A7D3 /* DocumentParser.cpp */,
    1669416696                                BCCFBAE70B5152ED0001F1D7 /* DocumentParser.h */,
    1669516697                                A8185F3209765765005826D9 /* DocumentType.cpp */,
     
    1673716739                                93831B560D087D6000E5C984 /* ExceptionCode.cpp */,
    1673816740                                935FBCF109BA143B00E230B1 /* ExceptionCode.h */,
     16741                                A853123C11D0471B00D4D077 /* FragmentScriptingPermission.h */,
    1673916742                                08700BE60F086C5300919419 /* InputElement.cpp */,
    1674016743                                08591AA40F085C4E009BACB1 /* InputElement.h */,
     
    1681916822                                D23CA56B0AB0EB8D005108A5 /* RangeException.h */,
    1682016823                                D23CA5480AB0E983005108A5 /* RangeException.idl */,
     16824                                A84D827B11D333ED00972990 /* RawDataDocumentParser.h */,
    1682116825                                85031B350A44EFC700F992E0 /* RegisteredEventListener.cpp */,
    1682216826                                85031B360A44EFC700F992E0 /* RegisteredEventListener.h */,
     
    1687816882                                5D15E3A90F9E6AC1009E0E3F /* XMLDocumentParserScope.cpp */,
    1687916883                                5D15E3AA0F9E6AC1009E0E3F /* XMLDocumentParserScope.h */,
    16880                                 A853123C11D0471B00D4D077 /* FragmentScriptingPermission.h */,
    1688116884                        );
    1688216885                        path = dom;
     
    2185821861                                A8E6A78211D1661B00311F4A /* HTMLParserScheduler.cpp in Sources */,
    2185921862                                CEA3949C11D45CDA003094CF /* StaticHashSetNodeList.cpp in Sources */,
     21863                                A8C2280E11D4A59700D5A7D3 /* DocumentParser.cpp in Sources */,
    2186021864                        );
    2186121865                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/dom/DocumentParser.cpp

    r61912 r61913  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010 Google, Inc. All Rights Reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    1111 *    documentation and/or other materials provided with the distribution.
    1212 *
    13  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
     13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
    1414 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1515 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
     16 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
    1717 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    1818 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     
    2121 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    2222 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2424 */
    2525
    2626#include "config.h"
    27 #include "SinkDocument.h"
     27#include "DocumentParser.h"
    2828
    29 #include "RawDataDocumentParser.h"
     29#include "DocumentWriter.h"
     30#include "SegmentedString.h"
     31#include "TextResourceDecoder.h"
     32
     33#include <wtf/Assertions.h>
    3034
    3135namespace WebCore {
    3236
    33 SinkDocument::SinkDocument(Frame* frame, const KURL& url)
    34     : HTMLDocument(frame, url)
     37DocumentParser::DocumentParser(Document* document, bool viewSourceMode)
     38    : m_parserStopped(false)
     39    , m_inViewSourceMode(viewSourceMode)
     40    , m_document(document)
     41    , m_XSSAuditor(0)
    3542{
    36     setParseMode(Compat);
     43    ASSERT(document);
    3744}
    3845
    39 DocumentParser* SinkDocument::createParser()
     46void DocumentParser::appendBytes(DocumentWriter* writer , const char* data, int length, bool shouldFlush)
    4047{
    41     // The basic RawDataDocumentParser does nothing with the data
    42     // which is sufficient for our purposes here.
    43     return new RawDataDocumentParser(this);
     48    if (!length && !shouldFlush)
     49        return;
     50
     51    TextResourceDecoder* decoder = writer->createDecoderIfNeeded();
     52    String decoded = decoder->decode(data, length);
     53    if (shouldFlush)
     54        decoded += decoder->flush();
     55    if (decoded.isEmpty())
     56        return;
     57
     58    writer->reportDataRecieved();
     59
     60    append(decoded);
    4461}
    4562
    46 } // namespace WebCore
     63};
     64
  • trunk/WebCore/dom/DocumentParser.h

    r61904 r61913  
    2525#define DocumentParser_h
    2626
    27 #include <wtf/Assertions.h>
     27#include <wtf/Noncopyable.h>
    2828
    2929namespace WebCore {
    3030
    3131class Document;
     32class DocumentWriter;
    3233class LegacyHTMLTreeBuilder;
    3334class LegacyHTMLDocumentParser;
     
    3940    virtual ~DocumentParser() { }
    4041
    41     // insert is use by document.write
     42    // insert is used by document.write
    4243    virtual void insert(const SegmentedString&) = 0;
    43     // apend is used by DocumentWriter (the loader)
     44    // appendBytes is used by DocumentWriter (the loader)
     45    virtual void appendBytes(DocumentWriter*, const char* bytes, int length, bool flush);
     46
     47    // FIXME: append() should be private, but DocumentWriter::replaceDocument
     48    // uses it for now.
    4449    virtual void append(const SegmentedString&) = 0;
    4550
    4651    virtual void finish() = 0;
    4752    virtual bool finishWasCalled() = 0;
     53
    4854    virtual bool isWaitingForScripts() const = 0;
    4955    virtual bool isExecutingScript() const { return false; }
     
    5460    // actually implements it.
    5561    virtual bool processingData() const { return false; }
    56 
    57     virtual bool wantsRawData() const { return false; }
    58     virtual bool writeRawData(const char* /*data*/, int /*length*/)
    59     {
    60         ASSERT_NOT_REACHED();
    61         return false;
    62     }
    6362
    6463    virtual bool wellFormed() const { return true; }
     
    8382
    8483protected:
    85     DocumentParser(Document* document, bool viewSourceMode = false)
    86         : m_parserStopped(false)
    87         , m_inViewSourceMode(viewSourceMode)
    88         , m_document(document)
    89         , m_XSSAuditor(0)
    90     {
    91         ASSERT(document);
    92     }
     84    DocumentParser(Document*, bool viewSourceMode = false);
    9385
    9486    // The parser has buffers, so parsing may continue even after
  • trunk/WebCore/dom/RawDataDocumentParser.h

    r61904 r61913  
    3131namespace WebCore {
    3232
    33 // FIXME: It seems wrong that RawDataDocumentParser is a subclass of
    34 // DocumentParser.  RawDataDocumentParser, just wants to override an earlier
    35 // version of write() before the data is decoded.  Seems the decoding could
    36 // move into the base-class DocumentParser, and then RawDataDocumentParser
    37 // would just be short-circuting.  That could simplify some of the
    38 // DocumentWriter logic.
    3933class RawDataDocumentParser : public DocumentParser {
    4034public:
     
    7165
    7266    virtual bool isWaitingForScripts() const { return false; }
    73 
    74     virtual bool wantsRawData() const { return true; }
    75     virtual bool writeRawData(const char*, int) { return false; }
    7667};
    7768
  • trunk/WebCore/loader/DocumentWriter.cpp

    r61904 r61913  
    7474        }
    7575
    76         // FIXME: If we wanted to support the <img src='javascript:'imagedata'>
    77         // case then we would need to call addData(char*, int) instead.
     76        // FIXME: This should call DocumentParser::appendBytes instead of append
     77        // to support RawDataDocumentParsers.
    7878        if (DocumentParser* parser = m_frame->document()->parser())
    7979            parser->append(source);
     
    144144}
    145145
    146 void DocumentWriter::addData(const char* str, int len, bool flush)
    147 {
    148     if (len == 0 && !flush)
    149         return;
    150 
    151     if (len == -1)
    152         len = strlen(str);
    153 
    154     DocumentParser* parser = m_frame->document()->parser();
    155     if (parser && parser->wantsRawData()) {
    156         if (len > 0)
    157             parser->writeRawData(str, len);
    158         return;
    159     }
    160    
     146TextResourceDecoder* DocumentWriter::createDecoderIfNeeded()
     147{
    161148    if (!m_decoder) {
    162149        if (Settings* settings = m_frame->settings()) {
     
    188175        m_frame->document()->setDecoder(m_decoder.get());
    189176    }
    190 
    191     String decoded = m_decoder->decode(str, len);
    192     if (flush)
    193         decoded += m_decoder->flush();
    194     if (decoded.isEmpty())
    195         return;
    196 
     177    return m_decoder.get();
     178}
     179
     180void DocumentWriter::reportDataRecieved()
     181{
     182    ASSERT(m_decoder);
    197183    if (!m_receivedData) {
    198184        m_receivedData = true;
     
    201187        m_frame->document()->recalcStyle(Node::Force);
    202188    }
    203 
    204     if (parser) {
    205         ASSERT(!parser->wantsRawData());
    206         parser->append(decoded);
    207     }
     189}
     190
     191void DocumentWriter::addData(const char* str, int len, bool flush)
     192{
     193    if (len == -1)
     194        len = strlen(str);
     195
     196    DocumentParser* parser = m_frame->document()->parser();
     197    if (parser)
     198        parser->appendBytes(this, str, len, flush);
    208199}
    209200
  • trunk/WebCore/loader/DocumentWriter.h

    r61868 r61913  
    6868    void setDecoder(TextResourceDecoder*);
    6969
     70    // Exposed for DoucmentParser::appendBytes
     71    TextResourceDecoder* createDecoderIfNeeded();
     72    void reportDataRecieved();
     73
    7074private:
    7175    PassRefPtr<Document> createDocument(const KURL&);
  • trunk/WebCore/loader/ImageDocument.cpp

    r61868 r61913  
    8585
    8686private:
    87     virtual bool writeRawData(const char* data, int len);
     87    virtual void appendBytes(DocumentWriter*, const char*, int, bool);
    8888    virtual void finish();
    8989};
     
    119119}
    120120
    121 bool ImageDocumentParser::writeRawData(const char*, int)
     121void ImageDocumentParser::appendBytes(DocumentWriter*, const char*, int, bool)
    122122{
    123123    Frame* frame = document()->frame();
    124124    Settings* settings = frame->settings();
    125125    if (!frame->loader()->client()->allowImages(!settings || settings->areImagesEnabled()))
    126         return false;
     126        return;
    127127
    128128    CachedImage* cachedImage = document()->cachedImage();
     
    130130
    131131    document()->imageChanged();
    132    
    133     return false;
    134132}
    135133
  • trunk/WebCore/loader/MediaDocument.cpp

    r61868 r61913  
    5555
    5656private:
    57     virtual bool writeRawData(const char* data, int len);
     57    virtual void appendBytes(DocumentWriter*, const char*, int, bool);
    5858
    5959    void createDocumentStructure();
     
    9191    frame->loader()->activeDocumentLoader()->mainResourceLoader()->setShouldBufferData(false);
    9292}
    93    
    94 bool MediaDocumentParser::writeRawData(const char*, int)
     93
     94void MediaDocumentParser::appendBytes(DocumentWriter*, const char*, int, bool)
    9595{
    9696    ASSERT(!m_mediaElement);
    9797    if (m_mediaElement)
    98         return false;
    99        
     98        return;
     99
    100100    createDocumentStructure();
    101101    finish();
    102     return false;
    103102}
    104103   
  • trunk/WebCore/loader/PluginDocument.cpp

    r61868 r61913  
    5353
    5454private:
    55     virtual bool writeRawData(const char* data, int len);
     55    virtual void appendBytes(DocumentWriter*, const char*, int, bool);
    5656
    5757    void createDocumentStructure();
     
    9999    body->appendChild(embedElement, ec);   
    100100}
    101    
    102 bool PluginDocumentParser::writeRawData(const char*, int)
     101
     102void PluginDocumentParser::appendBytes(DocumentWriter*, const char*, int, bool)
    103103{
    104104    ASSERT(!m_embedElement);
    105105    if (m_embedElement)
    106         return false;
    107    
     106        return;
     107
    108108    createDocumentStructure();
    109109
    110     if (Frame* frame = document()->frame()) {
    111         Settings* settings = frame->settings();
    112         if (settings && frame->loader()->subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin)) {
    113             document()->updateLayout();
     110    Frame* frame = document()->frame();
     111    if (!frame)
     112        return;
     113    Settings* settings = frame->settings();
     114    if (!settings || !frame->loader()->subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin))
     115        return;
    114116
    115             if (RenderWidget* renderer = toRenderWidget(m_embedElement->renderer())) {
    116                 frame->loader()->client()->redirectDataToPlugin(renderer->widget());
    117                 frame->loader()->activeDocumentLoader()->mainResourceLoader()->setShouldBufferData(false);
    118             }
     117    document()->updateLayout();
    119118
    120             finish();
    121         }
     119    if (RenderWidget* renderer = toRenderWidget(m_embedElement->renderer())) {
     120        frame->loader()->client()->redirectDataToPlugin(renderer->widget());
     121        frame->loader()->activeDocumentLoader()->mainResourceLoader()->setShouldBufferData(false);
    122122    }
    123123
    124     return false;
     124    finish();
    125125}
    126126
  • trunk/WebCore/loader/SinkDocument.cpp

    r61868 r61913  
    3131namespace WebCore {
    3232
     33class SinkDocumentParser : public RawDataDocumentParser {
     34public:
     35    SinkDocumentParser(SinkDocument* document)
     36        : RawDataDocumentParser(document)
     37    {
     38    }
     39
     40private:
     41    // Ignore all data.
     42    virtual void appendBytes(DocumentWriter*, const char*, int, bool) { }
     43};
     44
    3345SinkDocument::SinkDocument(Frame* frame, const KURL& url)
    3446    : HTMLDocument(frame, url)
     
    3951DocumentParser* SinkDocument::createParser()
    4052{
    41     // The basic RawDataDocumentParser does nothing with the data
    42     // which is sufficient for our purposes here.
    43     return new RawDataDocumentParser(this);
     53    return new SinkDocumentParser(this);
    4454}
    4555
Note: See TracChangeset for help on using the changeset viewer.