Changeset 41780 in webkit


Ignore:
Timestamp:
Mar 17, 2009 12:24:35 PM (15 years ago)
Author:
Simon Fraser
Message:

2009-03-17 Simon Fraser <Simon Fraser>

Reviewed by Darin Adler

https://bugs.webkit.org/show_bug.cgi?id=24396

  • config.h: Add WTF_USE_ACCELERATED_COMPOSITING, defined to 0 for now, and add some comments to make the #ifdefs more readable.
  • css/CSSComputedStyleDeclaration.cpp: (WebCore::computedTransform): Add a comment to mention that we don't flatten the matrix.
  • css/MediaQueryEvaluator.cpp: (WebCore::transform_3dMediaFeatureEval): Have the 'transform-3d' media query evaluate to 'true' if 3d-rendering is supported.
  • platform/graphics/mac/GraphicsLayerCA.mm: (WebCore::GraphicsLayerCA::animateTransform): No need for the #ifdef here. If we don't support 3d, we will have already flattened the matrix.
  • platform/graphics/transforms/TransformationMatrix.cpp: (WebCore::TransformationMatrix::makeAffine):
  • platform/graphics/transforms/TransformationMatrix.h: New method to convert the matrix to an affine matrix by throwing a way the non-affine parts.
  • rendering/RenderLayer.cpp: (WebCore::RenderLayer::updateTransform): (WebCore::RenderLayer::currentTransform):
  • rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateLayerTransform): If 3d rendering is not supported, convert the matrix to an affine matrix which can be rendered, and used for hit testing.
  • rendering/RenderLayerCompositor.cpp: Change the name of the exported symbol that webkitdirs.pm uses to know if 3d rendering is supported. There is no other 3d-rendering-specific symbol we can sniff.
  • rendering/RenderObject.cpp: (WebCore::RenderObject::transformFromContainer): Only take perspective into account if 3d rendering is supported.
  • rendering/RenderObject.h: (WebCore::makeMatrixRenderable): Utility method that flattens a matrix if 3d rendering is not supported.
Location:
trunk
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r41779 r41780  
     12009-03-17  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Reviewed by Darin Adler
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=24396
     6
     7        * config.h:
     8        Add WTF_USE_ACCELERATED_COMPOSITING, defined to 0 for now, and add some
     9        comments to make the #ifdefs more readable.
     10
     11        * css/CSSComputedStyleDeclaration.cpp:
     12        (WebCore::computedTransform):
     13        Add a comment to mention that we don't flatten the matrix.
     14       
     15        * css/MediaQueryEvaluator.cpp:
     16        (WebCore::transform_3dMediaFeatureEval):
     17        Have the 'transform-3d' media query evaluate to 'true' if 3d-rendering
     18        is supported.
     19       
     20        * platform/graphics/mac/GraphicsLayerCA.mm:
     21        (WebCore::GraphicsLayerCA::animateTransform):
     22        No need for the #ifdef here. If we don't support 3d, we will have already flattened
     23        the matrix.
     24       
     25        * platform/graphics/transforms/TransformationMatrix.cpp:
     26        (WebCore::TransformationMatrix::makeAffine):
     27        * platform/graphics/transforms/TransformationMatrix.h:
     28        New method to convert the matrix to an affine matrix by throwing a way the non-affine
     29        parts.
     30       
     31        * rendering/RenderLayer.cpp:
     32        (WebCore::RenderLayer::updateTransform):
     33        (WebCore::RenderLayer::currentTransform):
     34        * rendering/RenderLayerBacking.cpp:
     35        (WebCore::RenderLayerBacking::updateLayerTransform):
     36        If 3d rendering is not supported, convert the matrix to an affine matrix
     37        which can be rendered, and used for hit testing.
     38       
     39        * rendering/RenderLayerCompositor.cpp:
     40        Change the name of the exported symbol that webkitdirs.pm uses to know if
     41        3d rendering is supported. There is no other 3d-rendering-specific symbol we can sniff.
     42       
     43        * rendering/RenderObject.cpp:
     44        (WebCore::RenderObject::transformFromContainer):
     45        Only take perspective into account if 3d rendering is supported.
     46
     47        * rendering/RenderObject.h:
     48        (WebCore::makeMatrixRenderable):
     49        Utility method that flattens a matrix if 3d rendering is not supported.
     50
    1512009-03-17  Kevin Ollivier  <kevino@theolliviers.com>
    252
  • trunk/WebCore/config.h

    r38183 r41780  
    101101
    102102#if PLATFORM(MAC)
     103// ATSUI vs. CoreText
    103104#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
    104105#define WTF_USE_ATSUI 0
     
    108109#define WTF_USE_CORE_TEXT 0
    109110#endif
     111
     112// New theme
    110113#define WTF_USE_NEW_THEME 1
     114
     115// Accelerated compositing
     116#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
     117#define WTF_USE_ACCELERATED_COMPOSITING 0
    111118#endif
     119#endif // PLATFORM(MAC)
    112120
    113121#if PLATFORM(SYMBIAN)
  • trunk/WebCore/css/CSSComputedStyleDeclaration.cpp

    r41468 r41780  
    423423    TransformationMatrix transform;
    424424    style->applyTransform(transform, box.size(), RenderStyle::ExcludeTransformOrigin);
     425    // Note that this does not flatten to an affine transform if ENABLE(3D_RENDERING) is off, by design.
    425426
    426427    RefPtr<WebKitCSSTransformValue> transformVal;
  • trunk/WebCore/css/MediaQueryEvaluator.cpp

    r39880 r41780  
    418418static bool transform_3dMediaFeatureEval(CSSValue* value, RenderStyle*, Frame*, MediaFeaturePrefix op)
    419419{
     420    bool returnValueIfNoParameter;
     421    int have3dRendering;
     422
     423#if ENABLE(3D_RENDERING)
     424    returnValueIfNoParameter = true;
     425    have3dRendering = 1;
     426#else
     427    returnValueIfNoParameter = false;
     428    have3dRendering = 0;
     429#endif
     430
    420431    if (value) {
    421432        float number;
    422         return numberValue(value, number) && compareValue(0, static_cast<int>(number), op);
    423     }
    424     return false;
     433        return numberValue(value, number) && compareValue(have3dRendering, static_cast<int>(number), op);
     434    }
     435    return returnValueIfNoParameter;
    425436}
    426437
  • trunk/WebCore/platform/graphics/mac/GraphicsLayerCA.mm

    r41397 r41780  
    947947            break;
    948948           
    949         TransformOperation::OperationType opType =
    950 #if ENABLE(3D_TRANSFORMS)
    951             isMatrixAnimation ? TransformOperation::MATRIX_3D : functionList[functionIndex];
    952 #else
    953             isMatrixAnimation ? TransformOperation::MATRIX : functionList[functionIndex];
    954 #endif       
     949        TransformOperation::OperationType opType = isMatrixAnimation ? TransformOperation::MATRIX_3D : functionList[functionIndex];
    955950
    956951        if (isKeyframe) {
  • trunk/WebCore/platform/graphics/transforms/TransformationMatrix.cpp

    r41531 r41780  
    951951}
    952952
     953void TransformationMatrix::makeAffine()
     954{
     955    m_matrix[0][2] = 0;
     956    m_matrix[0][3] = 0;
     957   
     958    m_matrix[1][2] = 0;
     959    m_matrix[1][3] = 0;
     960   
     961    m_matrix[2][0] = 0;
     962    m_matrix[2][1] = 0;
     963    m_matrix[2][2] = 1;
     964    m_matrix[2][3] = 0;
     965   
     966    m_matrix[3][2] = 0;
     967    m_matrix[3][3] = 1;
     968}
     969
    953970static inline void blendFloat(double& from, double to, double progress)
    954971{
  • trunk/WebCore/platform/graphics/transforms/TransformationMatrix.h

    r41531 r41780  
    249249    }
    250250
     251    // Throw away the non-affine parts of the matrix (lossy!)
     252    void makeAffine();
     253
    251254    bool operator==(const TransformationMatrix& m2) const
    252255    {
  • trunk/WebCore/rendering/RenderLayer.cpp

    r41637 r41780  
    330330        m_transform->makeIdentity();
    331331        box->style()->applyTransform(*m_transform, box->borderBoxRect().size(), RenderStyle::IncludeTransformOrigin);
     332        makeMatrixRenderable(*m_transform);
    332333    }
    333334
     
    346347        RefPtr<RenderStyle> style = renderer()->animation()->getAnimatedStyleForRenderer(renderer());
    347348        style->applyTransform(currTransform, renderBox()->borderBoxRect().size(), RenderStyle::IncludeTransformOrigin);
     349        makeMatrixRenderable(currTransform);
    348350        return currTransform;
    349351    }
  • trunk/WebCore/rendering/RenderLayerBacking.cpp

    r41389 r41780  
    114114    // baked into it, and we don't want that.
    115115    TransformationMatrix t;
    116     if (m_owningLayer->hasTransform())
     116    if (m_owningLayer->hasTransform()) {
    117117        style->applyTransform(t, toRenderBox(renderer())->borderBoxRect().size(), RenderStyle::ExcludeTransformOrigin);
     118        makeMatrixRenderable(t);
     119    }
    118120   
    119121    m_graphicsLayer->setTransform(t);
  • trunk/WebCore/rendering/RenderLayerCompositor.cpp

    r41531 r41780  
    5050#endif
    5151
    52 #if ENABLE(3D_TRANSFORMS)
    53 // This symbol is used to determine from a script whether 3D transforms are enabled (via 'nm').
    54 bool WebCoreHas3DTransforms = true;
     52#if ENABLE(3D_RENDERING)
     53// This symbol is used to determine from a script whether 3D rendering is enabled (via 'nm').
     54bool WebCoreHas3DRendering = true;
    5555#endif
    5656
  • trunk/WebCore/rendering/RenderObject.cpp

    r41769 r41780  
    17001700        containerTransform.multLeft(layer->currentTransform());
    17011701   
     1702#if ENABLE(3D_RENDERING)
    17021703    if (containerObject && containerObject->style()->hasPerspective()) {
    17031704        // Perpsective on the container affects us, so we have to factor it in here.
     
    17121713        containerTransform.translateRight3d(perspectiveOrigin.x(), perspectiveOrigin.y(), 0);
    17131714    }
     1715#else
     1716    UNUSED_PARAM(containerObject);
     1717#endif
    17141718
    17151719    return containerTransform;
  • trunk/WebCore/rendering/RenderObject.h

    r41769 r41780  
    912912}
    913913
     914inline void makeMatrixRenderable(TransformationMatrix& matrix)
     915{
     916#if !ENABLE(3D_RENDERING)
     917    matrix.makeAffine();
     918#endif
     919}
     920
    914921} // namespace WebCore
    915922
  • trunk/WebKit/mac/ChangeLog

    r41764 r41780  
     12009-03-17  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Reviewed by Darin Adler
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=24396
     6       
     7        Add WTF_USE_ACCELERATED_COMPOSITING, defined to 0 for now.
     8
     9        * WebKitPrefix.h:
     10
    1112009-03-17  Kevin Ollivier  <kevino@theolliviers.com>
    212
  • trunk/WebKit/mac/WebKitPrefix.h

    r41764 r41780  
    7979#endif
    8080
     81// Accelerated compositing (also needs to be set in WebCore/config.h)
     82#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
     83#define WTF_USE_ACCELERATED_COMPOSITING 0
     84#endif
     85
    8186/* WebKit has no way to pull settings from WebCore/config.h for now */
    8287/* so we assume WebKit is always being compiled on top of JavaScriptCore */
  • trunk/WebKitTools/ChangeLog

    r41776 r41780  
     12009-03-17  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Reviewed by Darin Adler
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=24396
     6
     7        Change the terminology from '3D transforms' to '3D rendering'.
     8
     9        * Scripts/build-webkit:
     10        * Scripts/run-webkit-tests:
     11        * Scripts/webkitdirs.pm:
     12
    1132009-03-17  Gustavo Noronha Silva  <gns@gnome.org>
    214
  • trunk/WebKitTools/Scripts/build-webkit

    r41776 r41780  
    6262my $showHelp = 0;
    6363my $clean = 0;
    64 my $threeDTransformsSupport = 0;
     64my $threeDRenderingSupport = 0;
    6565
    6666my $programName = basename($0);
     
    7272  --clean                       Cleanup the build directory
    7373  --gtk                         Build the GTK+ port
    74   --[no-]3d-transforms          Toggle 3D Transforms support (default: $threeDTransformsSupport)
     74  --[no-]3d-rendering           Toggle 3D rendering support (default: $threeDRenderingSupport)
    7575  --[no-]channel-messaging          Toggle MessageChannel and MessagePort support (default: $channelMessagingSupport)
    7676  --[no-]offline-web-applications   Toggle Offline Web Application Support (default : $offlineWebApplicationSupport)
     
    9696
    9797GetOptions(
    98            '3d-transforms!' => \$threeDTransformsSupport,
     98           '3d-rendering!' => \$threeDRenderingSupport,
    9999           'channel-messaging!' => \$channelMessagingSupport,
    100100           'database!' => \$databaseSupport,
     
    148148# and WebKit.xcconfig to prevent needless rebuilding when using both Xcode and build-webkit.
    149149
    150 push @overrideFeatureDefinesOption, "ENABLE_3D_TRANSFORMS" if $threeDTransformsSupport;
     150push @overrideFeatureDefinesOption, "ENABLE_3D_RENDERING" if $threeDRenderingSupport;
    151151push @overrideFeatureDefinesOption, "ENABLE_CHANNEL_MESSAGING" if $channelMessagingSupport;
    152152push @overrideFeatureDefinesOption, "ENABLE_DATABASE" if $databaseSupport;
     
    192192    push @options, autotoolsFlag($iconDatabaseSupport, "icon-database");
    193193    push @options, autotoolsFlag($offlineWebApplicationSupport, "offline-web-applications");
    194     push @options, autotoolsFlag($threeDTransformsSupport, "3D-transforms");
     194    push @options, autotoolsFlag($threeDRenderingSupport, "3D-rendering");
    195195    push @options, autotoolsFlag($channelMessagingSupport, "channel-messaging");
    196196    push @options, autotoolsFlag($svgSupport, "svg");
  • trunk/WebKitTools/Scripts/run-webkit-tests

    r41702 r41780  
    366366}
    367367
    368 if (!checkWebCore3DTransformsSupport(0)) {
     368if (!checkWebCore3DRenderingSupport(0)) {
    369369    $ignoredDirectories{'animations/3d'} = 1;
    370370    $ignoredDirectories{'transforms/3d'} = 1;
  • trunk/WebKitTools/Scripts/webkitdirs.pm

    r41760 r41780  
    570570}
    571571
    572 sub has3DTransformsSupport
     572sub has3DRenderingSupport
    573573{
    574574    return 0 if isCygwin() || isQt();
     
    576576    my $path = shift;
    577577
    578     my $has3DTransformsSupport = 0;
     578    my $has3DRenderingSupport = 0;
    579579    if (-e $path) {
    580580        open NM, "-|", "nm", $path or die;
    581581        while (<NM>) {
    582             $has3DTransformsSupport = 1 if /WebCoreHas3DTransforms/;
     582            $has3DRenderingSupport = 1 if /WebCoreHas3DRendering/;
    583583        }
    584584        close NM;
    585585    }
    586     return $has3DTransformsSupport;
    587 }
    588 
    589 sub checkWebCore3DTransformsSupport
     586    return $has3DRenderingSupport;
     587}
     588
     589sub checkWebCore3DRenderingSupport
    590590{
    591591    my $required = shift;
    592592    my $framework = "WebCore";
    593593    my $path = builtDylibPathForName($framework);
    594     my $has3DTransforms = has3DTransformsSupport($path);
    595     if ($required && !$has3DTransforms) {
    596         die "$framework at \"$path\" does not include 3D Transforms Support, please run build-webkit --3d-transforms\n";
    597     }
    598     return $has3DTransforms;
     594    my $has3DRendering = has3DRenderingSupport($path);
     595    if ($required && !$has3DRendering) {
     596        die "$framework at \"$path\" does not include 3D rendering Support, please run build-webkit --3d-rendering\n";
     597    }
     598    return $has3DRendering;
    599599}
    600600
Note: See TracChangeset for help on using the changeset viewer.