Changeset 80439 in webkit


Ignore:
Timestamp:
Mar 6, 2011 4:22:46 PM (13 years ago)
Author:
dbates@webkit.org
Message:

2011-03-06 Daniel Bates <dbates@rim.com>

Reviewed by Darin Adler.

style.borderSpacing always returns empty string
https://bugs.webkit.org/show_bug.cgi?id=54816

Teach CSSMutableStyleDeclaration::getPropertyValue() how to reconstitute
the value for border-spacing from the value of the WebKit internal CSS
property -webkit-border-horizontal-spacing and -webkit-border-vertical-spacing.

The CSS property border-spacing describes the horizontal and vertical border
spacing for an HTML Table element. Notice, WebKit internally represents the value
of this property as two properties: -webkit-border-horizontal-spacing and
-webkit-border-vertical-spacing, for the horizontal and vertical border spacing,
respectively. And WebKit doesn't know to reconstitute these internal properties.
Therefore style.borderSpacing always returns the empty string.

Test: fast/css/table-border-spacing.html

  • css/CSSMutableStyleDeclaration.cpp: (WebCore::CSSMutableStyleDeclaration::getPropertyValue): (WebCore::CSSMutableStyleDeclaration::borderSpacingValue): Added.
  • css/CSSMutableStyleDeclaration.h:

2011-03-06 Daniel Bates <dbates@rim.com>

Reviewed by Darin Adler.

style.borderSpacing always returns empty string
https://bugs.webkit.org/show_bug.cgi?id=54816

Tests that style.borderSpacing returns the correct result for valid, negative, and missing border-spacing values.

  • fast/css/table-border-spacing-expected.txt: Added.
  • fast/css/table-border-spacing.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r80438 r80439  
     12011-03-06  Daniel Bates  <dbates@rim.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        style.borderSpacing always returns empty string
     6        https://bugs.webkit.org/show_bug.cgi?id=54816
     7
     8        Tests that style.borderSpacing returns the correct result for valid, negative, and missing border-spacing values.
     9
     10        * fast/css/table-border-spacing-expected.txt: Added.
     11        * fast/css/table-border-spacing.html: Added.
     12
    1132011-03-06  Dan Bernstein  <mitz@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r80438 r80439  
     12011-03-06  Daniel Bates  <dbates@rim.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        style.borderSpacing always returns empty string
     6        https://bugs.webkit.org/show_bug.cgi?id=54816
     7
     8        Teach CSSMutableStyleDeclaration::getPropertyValue() how to reconstitute
     9        the value for border-spacing from the value of the WebKit internal CSS
     10        property -webkit-border-horizontal-spacing and -webkit-border-vertical-spacing.
     11
     12        The CSS property border-spacing describes the horizontal and vertical border
     13        spacing for an HTML Table element. Notice, WebKit internally represents the value
     14        of this property as two properties: -webkit-border-horizontal-spacing and
     15        -webkit-border-vertical-spacing, for the horizontal and vertical border spacing,
     16        respectively. And WebKit doesn't know to reconstitute these internal properties.
     17        Therefore style.borderSpacing always returns the empty string.
     18
     19        Test: fast/css/table-border-spacing.html
     20
     21        * css/CSSMutableStyleDeclaration.cpp:
     22        (WebCore::CSSMutableStyleDeclaration::getPropertyValue):
     23        (WebCore::CSSMutableStyleDeclaration::borderSpacingValue): Added.
     24        * css/CSSMutableStyleDeclaration.h:
     25
    1262011-03-06  Dan Bernstein  <mitz@apple.com>
    227
  • trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp

    r79985 r80439  
    22 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
    33 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
     4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    3536#include "InspectorInstrumentation.h"
    3637#include "StyledElement.h"
     38#include <wtf/text/StringConcatenate.h>
    3739
    3840using namespace std;
     
    121123    // Shorthand and 4-values properties
    122124    switch (propertyID) {
     125        case CSSPropertyBorderSpacing: {
     126            const int properties[2] = { CSSPropertyWebkitBorderHorizontalSpacing, CSSPropertyWebkitBorderVerticalSpacing };
     127            return borderSpacingValue(properties);
     128        }
    123129        case CSSPropertyBackgroundPosition: {
    124130            // FIXME: Is this correct? The code in cssparser.cpp is confusing
     
    267273    }
    268274    return String();
     275}
     276
     277String CSSMutableStyleDeclaration::borderSpacingValue(const int properties[2]) const
     278{
     279    RefPtr<CSSValue> horizontalValue = getPropertyCSSValue(properties[0]);
     280    RefPtr<CSSValue> verticalValue = getPropertyCSSValue(properties[1]);
     281
     282    if (!horizontalValue)
     283        return String();
     284    ASSERT(verticalValue); // By <http://www.w3.org/TR/CSS21/tables.html#separated-borders>.
     285
     286    String horizontalValueCSSText = horizontalValue->cssText();
     287    String verticalValueCSSText = verticalValue->cssText();
     288    if (horizontalValueCSSText == verticalValueCSSText)
     289        return horizontalValueCSSText;
     290    return makeString(horizontalValueCSSText, ' ', verticalValueCSSText);
    269291}
    270292
  • trunk/Source/WebCore/css/CSSMutableStyleDeclaration.h

    r79985 r80439  
    157157    String getLayeredShorthandValue(const int* properties, unsigned number) const;
    158158    String get4Values(const int* properties) const;
     159    String borderSpacingValue(const int properties[2]) const;
    159160   
    160161    void setPropertyInternal(const CSSProperty&, CSSProperty* slot = 0);
Note: See TracChangeset for help on using the changeset viewer.