Changeset 63038 in webkit


Ignore:
Timestamp:
Jul 9, 2010 9:08:32 PM (14 years ago)
Author:
arv@chromium.org
Message:

2010-07-09 Erik Arvidsson <arv@chromium.org>

Reviewed by Darin Adler.

Computed style is not implemented for padding-start, padding-end, margin-start, margin-end
https://bugs.webkit.org/show_bug.cgi?id=41496

  • fast/css/margin-start-end-expected.txt:
  • fast/css/padding-start-end-expected.txt:
  • fast/css/script-tests/margin-start-end.js: Added tests for computed style.
  • fast/css/script-tests/padding-start-end.js: Added tests for computed style.

2010-07-09 Erik Arvidsson <arv@chromium.org>

Reviewed by Darin Adler.

Computed style is not implemented for padding-start, padding-end, margin-start, margin-end
https://bugs.webkit.org/show_bug.cgi?id=41496

  • css/CSSComputedStyleDeclaration.cpp: (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
  • css/CSSProperty.cpp: (WebCore::CSSProperty::resolveDirectionAwareProperty): This function resolves the property ID for a direction aware property.
  • css/CSSProperty.h:
  • css/CSSStyleSelector.cpp: Use helper function. (WebCore::CSSStyleSelector::applyProperty):
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r63034 r63038  
     12010-07-09  Erik Arvidsson  <arv@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Computed style is not implemented for padding-start, padding-end, margin-start, margin-end
     6        https://bugs.webkit.org/show_bug.cgi?id=41496
     7
     8        * fast/css/margin-start-end-expected.txt:
     9        * fast/css/padding-start-end-expected.txt:
     10        * fast/css/script-tests/margin-start-end.js: Added tests for computed style.
     11        * fast/css/script-tests/padding-start-end.js: Added tests for computed style.
     12
    1132010-07-09  Daniel Bates  <dbates@rim.com>
    214
  • trunk/LayoutTests/fast/css/margin-start-end-expected.txt

    r62877 r63038  
    88PASS test("ltr", "-webkit-margin-start", "10px", "margin-left") is "10px"
    99PASS test("ltr", "-webkit-margin-end", "20px", "margin-right") is "20px"
     10PASS test("ltr", "margin-left", "10px", "-webkit-margin-start") is "10px"
     11PASS test("ltr", "margin-right", "20px", "-webkit-margin-end") is "20px"
    1012PASS test("rtl", "-webkit-margin-start", "10px", "width") is "90px"
    1113PASS test("rtl", "-webkit-margin-end", "20px", "width") is "80px"
    1214PASS test("rtl", "-webkit-margin-start", "10px", "margin-right") is "10px"
    1315PASS test("rtl", "-webkit-margin-end", "20px", "margin-left") is "20px"
     16PASS test("rtl", "margin-right", "10px", "-webkit-margin-start") is "10px"
     17PASS test("rtl", "margin-left", "20px", "-webkit-margin-end") is "20px"
    1418PASS successfullyParsed is true
    1519
  • trunk/LayoutTests/fast/css/padding-start-end-expected.txt

    r62877 r63038  
    88PASS test("ltr", "-webkit-padding-start", "10px", "padding-left") is "10px"
    99PASS test("ltr", "-webkit-padding-end", "20px", "padding-right") is "20px"
     10PASS test("ltr", "padding-left", "10px", "-webkit-padding-start") is "10px"
     11PASS test("ltr", "padding-right", "20px", "-webkit-padding-end") is "20px"
    1012PASS testWidth("rtl", "-webkit-padding-start", "10px") is 110
    1113PASS testWidth("rtl", "-webkit-padding-end", "20px") is 120
    1214PASS test("rtl", "-webkit-padding-start", "10px", "padding-right") is "10px"
    1315PASS test("rtl", "-webkit-padding-end", "20px", "padding-left") is "20px"
     16PASS test("rtl", "padding-right", "10px", "-webkit-padding-start") is "10px"
     17PASS test("rtl", "padding-left", "20px", "-webkit-padding-end") is "20px"
    1418PASS successfullyParsed is true
    1519
  • trunk/LayoutTests/fast/css/script-tests/margin-start-end.js

    r62877 r63038  
    2222shouldBeEqualToString('test("ltr", "-webkit-margin-start", "10px", "margin-left")', '10px');
    2323shouldBeEqualToString('test("ltr", "-webkit-margin-end", "20px", "margin-right")', '20px');
     24shouldBeEqualToString('test("ltr", "margin-left", "10px", "-webkit-margin-start")', '10px');
     25shouldBeEqualToString('test("ltr", "margin-right", "20px", "-webkit-margin-end")', '20px');
    2426
    2527shouldBeEqualToString('test("rtl", "-webkit-margin-start", "10px", "width")', '90px');
     
    2729shouldBeEqualToString('test("rtl", "-webkit-margin-start", "10px", "margin-right")', '10px');
    2830shouldBeEqualToString('test("rtl", "-webkit-margin-end", "20px", "margin-left")', '20px');
     31shouldBeEqualToString('test("rtl", "margin-right", "10px", "-webkit-margin-start")', '10px');
     32shouldBeEqualToString('test("rtl", "margin-left", "20px", "-webkit-margin-end")', '20px');
    2933
    3034successfullyParsed = true;
  • trunk/LayoutTests/fast/css/script-tests/padding-start-end.js

    r62877 r63038  
    2929shouldBeEqualToString('test("ltr", "-webkit-padding-start", "10px", "padding-left")', '10px');
    3030shouldBeEqualToString('test("ltr", "-webkit-padding-end", "20px", "padding-right")', '20px');
     31shouldBeEqualToString('test("ltr", "padding-left", "10px", "-webkit-padding-start")', '10px');
     32shouldBeEqualToString('test("ltr", "padding-right", "20px", "-webkit-padding-end")', '20px');
    3133
    3234shouldBe('testWidth("rtl", "-webkit-padding-start", "10px")', '110');
     
    3436shouldBeEqualToString('test("rtl", "-webkit-padding-start", "10px", "padding-right")', '10px');
    3537shouldBeEqualToString('test("rtl", "-webkit-padding-end", "20px", "padding-left")', '20px');
     38shouldBeEqualToString('test("rtl", "padding-right", "10px", "-webkit-padding-start")', '10px');
     39shouldBeEqualToString('test("rtl", "padding-left", "20px", "-webkit-padding-end")', '20px');
    3640
    3741successfullyParsed = true;
  • trunk/WebCore/ChangeLog

    r63037 r63038  
     12010-07-09  Erik Arvidsson  <arv@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Computed style is not implemented for padding-start, padding-end, margin-start, margin-end
     6        https://bugs.webkit.org/show_bug.cgi?id=41496
     7
     8        * css/CSSComputedStyleDeclaration.cpp:
     9        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
     10        * css/CSSProperty.cpp:
     11        (WebCore::CSSProperty::resolveDirectionAwareProperty): This function resolves the property ID for a direction aware property.
     12        * css/CSSProperty.h:
     13        * css/CSSStyleSelector.cpp: Use helper function.
     14        (WebCore::CSSStyleSelector::applyProperty):
     15
    1162010-07-09  Adam Barth  <abarth@webkit.org>
    217
  • trunk/WebCore/css/CSSComputedStyleDeclaration.cpp

    r62877 r63038  
    683683    if (!style)
    684684        return 0;
     685
     686    propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style->direction());
    685687
    686688    switch (static_cast<CSSPropertyID>(propertyID)) {
     
    14701472        case CSSPropertyWebkitMaskRepeatX:
    14711473        case CSSPropertyWebkitMaskRepeatY:
    1472         case CSSPropertyWebkitPaddingEnd:
    1473         case CSSPropertyWebkitPaddingStart:
    14741474        case CSSPropertyWebkitPerspectiveOriginX:
    14751475        case CSSPropertyWebkitPerspectiveOriginY:
  • trunk/WebCore/css/CSSProperty.cpp

    r50583 r63038  
    3939}
    4040
     41int CSSProperty::resolveDirectionAwareProperty(int propertyID, TextDirection direction)
     42{
     43    switch (static_cast<CSSPropertyID>(propertyID)) {
     44    case CSSPropertyWebkitMarginEnd:
     45        return direction == LTR ? CSSPropertyMarginRight : CSSPropertyMarginLeft;
     46    case CSSPropertyWebkitMarginStart:
     47        return direction == LTR ? CSSPropertyMarginLeft : CSSPropertyMarginRight;
     48    case CSSPropertyWebkitPaddingEnd:
     49        return direction == LTR ? CSSPropertyPaddingRight : CSSPropertyPaddingLeft;
     50    case CSSPropertyWebkitPaddingStart:
     51        return direction == LTR ? CSSPropertyPaddingLeft : CSSPropertyPaddingRight;
     52    default:
     53        return propertyID;
     54    }
     55}
     56
    4157} // namespace WebCore
  • trunk/WebCore/css/CSSProperty.h

    r50583 r63038  
    2323
    2424#include "CSSValue.h"
     25#include "TextDirection.h"
    2526#include <wtf/PassRefPtr.h>
    2627#include <wtf/RefPtr.h>
     
    5960    String cssText() const;
    6061
     62    static int resolveDirectionAwareProperty(int propertyID, TextDirection);
     63
    6164    friend bool operator==(const CSSProperty&, const CSSProperty&);
    6265
  • trunk/WebCore/css/CSSStyleSelector.cpp

    r62877 r63038  
    31093109    bool isInitial = valueType == CSSValue::CSS_INITIAL || (!m_parentNode && valueType == CSSValue::CSS_INHERIT);
    31103110   
    3111     // These properties are used to set the correct margins/padding on RTL lists.
    3112     if (id == CSSPropertyWebkitMarginEnd)
    3113         id = m_style->direction() == LTR ? CSSPropertyMarginRight : CSSPropertyMarginLeft;
    3114     else if (id == CSSPropertyWebkitMarginStart)
    3115         id = m_style->direction() == LTR ? CSSPropertyMarginLeft : CSSPropertyMarginRight;
    3116     else if (id == CSSPropertyWebkitPaddingEnd)
    3117         id = m_style->direction() == LTR ? CSSPropertyPaddingRight : CSSPropertyPaddingLeft;
    3118     else if (id == CSSPropertyWebkitPaddingStart)
    3119         id = m_style->direction() == LTR ? CSSPropertyPaddingLeft : CSSPropertyPaddingRight;
     3111    id = CSSProperty::resolveDirectionAwareProperty(id, m_style->direction());
    31203112
    31213113    if (m_checker.m_matchVisitedPseudoClass && !isValidVisitedLinkProperty(id)) {
Note: See TracChangeset for help on using the changeset viewer.