Changeset 83065 in webkit


Ignore:
Timestamp:
Apr 6, 2011 10:03:26 AM (13 years ago)
Author:
morrita@google.com
Message:

2011-04-06 MORITA Hajime <morrita@google.com>

Reviewed by Dimitri Glazkov.

[Refactoring] <progress> should not have manual layout code.
https://bugs.webkit.org/show_bug.cgi?id=57801

Updated progress-bar-value-pseudo-element.html to have wider coverage and
follow pseudo class change.

  • fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element.html:
  • platform/chromium/test_expectations.txt:
  • platform/mac/fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element-expected.checksum:
  • platform/mac/fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element-expected.png:
  • platform/mac/fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element-expected.txt:

2011-04-06 MORITA Hajime <morrita@google.com>

Reviewed by Dimitri Glazkov.

[Refactoring] <progress> should not have manual layout code.
https://bugs.webkit.org/show_bug.cgi?id=57801

  • Simplified RenderProgress, removing its custom layout code
  • Introducing ProgressValueElement and ProgressBarElement, replacing ProgressBarValueElement.

Now the structure is almost identical to <meter>,
other than:

  • RenderProgress has animated painting, thus manages its own timer.
  • Both ProgressValueElement and ProgressBarElement has pseudo classes which don't changes during its lifetime.
  • Android.mk:
  • CMakeLists.txt:
  • GNUmakefile.am:
  • WebCore.gypi:
  • WebCore.pro:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • css/html.css: (progress): (progress::-webkit-progress-bar): (progress::-webkit-progress-value):
  • html/HTMLProgressElement.cpp: (WebCore::HTMLProgressElement::~HTMLProgressElement): (WebCore::HTMLProgressElement::create): (WebCore::HTMLProgressElement::attach): (WebCore::HTMLProgressElement::didElementStateChange): (WebCore::HTMLProgressElement::createShadowSubtree):
  • html/HTMLProgressElement.h:
  • html/shadow/ProgressShadowElement.cpp: Copied from Source/WebCore/html/shadow/ProgressBarValueElement.h. (WebCore::ProgressShadowElement::ProgressShadowElement): (WebCore::ProgressShadowElement::progressElement): (WebCore::ProgressShadowElement::rendererIsNeeded): (WebCore::ProgressBarElement::shadowPseudoId): (WebCore::ProgressValueElement::shadowPseudoId): (WebCore::ProgressValueElement::setWidthPercentage):
  • html/shadow/ProgressShadowElement.h: Renamed from Source/WebCore/html/shadow/ProgressBarValueElement.h. (WebCore::ProgressBarElement::ProgressBarElement): (WebCore::ProgressBarElement::create): (WebCore::ProgressValueElement::ProgressValueElement): (WebCore::ProgressValueElement::create):
  • rendering/RenderProgress.cpp: (WebCore::RenderProgress::RenderProgress): (WebCore::RenderProgress::updateFromElement): (WebCore::RenderProgress::animationTimerFired):
  • rendering/RenderProgress.h: (WebCore::RenderProgress::requiresForcedStyleRecalcPropagation): (WebCore::RenderProgress::canHaveChildren):
Location:
trunk
Files:
19 edited
1 copied
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r83057 r83065  
     12011-04-06  MORITA Hajime  <morrita@google.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        [Refactoring] <progress> should not have manual layout code.
     6        https://bugs.webkit.org/show_bug.cgi?id=57801
     7
     8        Updated progress-bar-value-pseudo-element.html to have wider coverage and
     9        follow pseudo class change.
     10
     11        * fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element.html:
     12        * platform/chromium/test_expectations.txt:
     13        * platform/mac/fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element-expected.checksum:
     14        * platform/mac/fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element-expected.png:
     15        * platform/mac/fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element-expected.txt:
     16
    1172011-04-06  Adrienne Walker  <enne@google.com>
    218
  • trunk/LayoutTests/fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element.html

    r77578 r83065  
    22<head><script>
    33window.onload = function() {
    4     document.getElementById("toChangeStyle").setAttribute("style", "border:3px red dotted; background-color:cyan;");
    5     document.getElementById("toAddStyle").setAttribute("style", "border:3px red dotted; background-color:cyan; -webkit-appearance: none;");
     4    document.getElementById("removingAppearanceDynamically").setAttribute("style", "-webkit-appearance: none;");
     5    document.getElementById("givingProgressStyleDynamically").setAttribute("style", "background-color: lightblue;");
    66}
    77</script>
    88<style>
    99.styled { -webkit-appearance: none; }
    10 .styled::-webkit-progress-bar-value { background-color: lightgray; }
    11 #toAddStyle::-webkit-progress-bar-value {background-color:darkblue;}
     10.transparent-bar::-webkit-progress-bar { background-color: transparent; }
     11.transparent-value::-webkit-progress-value { background-color: transparent; }
     12.progress-style { border:3px solid #006; background-color: blue; }
     13.bar-style::-webkit-progress-bar { background-color: red; border:3px solid #900; }
     14.value-style::-webkit-progress-value { background-color: yellow; border:3px solid #990; }
    1215</style>
    1316</head>
    1417<body>
    1518  <ul>
    16     <li>
    17       Giving style statically : background-color:
    18       <progress class="styled" max=100 value=70 style="width:300px; height:50px; background-color:blue; " >
    19     </li>
    20     <li>
    21       Giving style statically : border:
    22       <progress class="styled" style="border:3px solid red;" value=0.5>
    23     </li>
    24     <li>
    25       Giving style statically, only for -webkit-progress-bar-value:
    26       <progress class="styled" value=0.5></progress>
    27     </li>
    28     <li>
    29       Adding style dynamically:
    30       <progress value=0.5 id="toAddStyle"></progress>
    31     </li>
    32     <li>
    33       Changing style dynamically:
    34       <progress class="styled" max=100 value=70 dir="rtl" id="toChangeStyle"></progress>
    35     </li>
     19    <li>Default style: <progress value=0.1 style="-webkit-appearance: none;" ></li>
     20    <li>Progress style: <progress class="styled transparent-bar progress-style" value=0.2>
     21    <li>Progress style (size): <progress class="styled" style="width: 300px; height: 30px;" value=0.3>
     22    <li>Bar style: <progress class="styled bar-style" value=0.4>
     23    <li>Value style: <progress class="styled value-style" value=0.5>
     24    <li>Styling for all three elements: <progress class="styled progress-style bar-style value-style" style="height:30px" value=0.6>
     25    <li>Removing appearance dynamically: <progress id="removingAppearanceDynamically" value=0.7>
     26    <li>Giving progress style change dynamically: <progress id="givingProgressStyleDynamically" class="styled transparent-bar" value=0.8>
    3627  </ul>
    3728</body>
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r83053 r83065  
    32853285BUGWK50661 WIN LINUX : fast/dom/HTMLMeterElement/meter-styles.html = IMAGE+TEXT PASS
    32863286
     3287// Need rebaselines
     3288BUGMORRITA WIN LINUX : fast/dom/HTMLProgressElement/progress-element.html = TEXT
     3289BUGMORRITA WIN LINUX MAC : fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element.html = IMAGE+TEXT
     3290
    32873291// Need rebaselines on all platforms.
    32883292BUGENNE : svg/W3C-SVG-1.1-SE/text-tspan-02-b.svg = FAIL
  • trunk/LayoutTests/platform/mac/fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element-expected.checksum

    r71073 r83065  
    1 1dc2e8bf7b48667508223bdf9c64caa8
     1eb18dbe86f7657ce59c56df924422cac
  • trunk/LayoutTests/platform/mac/fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element-expected.txt

    r61993 r83065  
    44  RenderBlock {HTML} at (0,0) size 800x600
    55    RenderBody {BODY} at (8,8) size 784x576
    6       RenderBlock {UL} at (0,0) size 784x138
    7         RenderListItem {LI} at (40,0) size 744x51
    8           RenderListMarker at (-17,33) size 7x18: bullet
    9           RenderText {#text} at (0,33) size 268x18
    10             text run at (0,33) width 268: "Giving style statically : background-color: "
    11           RenderProgress {PROGRESS} at (268,0) size 300x50 [bgcolor=#0000FF]
    12             RenderBlock {DIV} at (0,0) size 210x50 [bgcolor=#D3D3D3]
    13         RenderListItem {LI} at (40,51) size 744x23
    14           RenderListMarker at (-17,5) size 7x18: bullet
    15           RenderText {#text} at (0,5) size 197x18
    16             text run at (0,5) width 197: "Giving style statically : border: "
    17           RenderProgress {PROGRESS} at (197,0) size 166x22 [bgcolor=#808080] [border: (3px solid #FF0000)]
    18             RenderBlock {DIV} at (3,3) size 80x16 [bgcolor=#D3D3D3]
    19         RenderListItem {LI} at (40,74) size 744x18
     6      RenderBlock {UL} at (0,0) size 784x170
     7        RenderListItem {LI} at (40,0) size 744x18
    208          RenderListMarker at (-17,0) size 7x18: bullet
    21           RenderText {#text} at (0,0) size 376x18
    22             text run at (0,0) width 376: "Giving style statically, only for -webkit-progress-bar-value: "
    23           RenderProgress {PROGRESS} at (376,1) size 160x16 [bgcolor=#808080]
    24             RenderBlock {DIV} at (0,0) size 80x16 [bgcolor=#D3D3D3]
    25           RenderText {#text} at (0,0) size 0x0
    26         RenderListItem {LI} at (40,92) size 744x23
    27           RenderListMarker at (-17,5) size 7x18: bullet
    28           RenderText {#text} at (0,5) size 170x18
    29             text run at (0,5) width 170: "Adding style dynamically: "
    30           RenderProgress {PROGRESS} at (170,0) size 166x22 [bgcolor=#00FFFF] [border: (3px dotted #FF0000)]
    31             RenderBlock {DIV} at (3,3) size 80x16 [bgcolor=#00008B]
    32           RenderText {#text} at (0,0) size 0x0
    33         RenderListItem {LI} at (40,115) size 744x23
    34           RenderListMarker at (-17,5) size 7x18: bullet
    35           RenderText {#text} at (0,5) size 184x18
    36             text run at (0,5) width 184: "Changing style dynamically: "
    37           RenderProgress {PROGRESS} at (184,0) size 166x22 [bgcolor=#00FFFF] [border: (3px dotted #FF0000)]
    38             RenderBlock {DIV} at (51,3) size 112x16 [bgcolor=#D3D3D3]
    39           RenderText {#text} at (0,0) size 0x0
     9          RenderText {#text} at (0,0) size 88x18
     10            text run at (0,0) width 88: "Default style: "
     11          RenderProgress {PROGRESS} at (88,1) size 160x16
     12            RenderBlock {DIV} at (0,0) size 160x16 [bgcolor=#808080]
     13              RenderBlock {DIV} at (0,0) size 16x16 [bgcolor=#008000]
     14        RenderListItem {LI} at (40,18) size 744x18
     15          RenderListMarker at (-17,0) size 7x18: bullet
     16          RenderText {#text} at (0,0) size 95x18
     17            text run at (0,0) width 95: "Progress style: "
     18          RenderProgress {PROGRESS} at (95,1) size 160x16 [bgcolor=#0000FF] [border: (3px solid #000066)]
     19            RenderBlock {DIV} at (3,3) size 154x10
     20              RenderBlock {DIV} at (0,0) size 30x10 [bgcolor=#008000]
     21        RenderListItem {LI} at (40,36) size 744x31
     22          RenderListMarker at (-17,13) size 7x18: bullet
     23          RenderText {#text} at (0,13) size 133x18
     24            text run at (0,13) width 133: "Progress style (size): "
     25          RenderProgress {PROGRESS} at (133,0) size 300x30
     26            RenderBlock {DIV} at (0,0) size 300x30 [bgcolor=#808080]
     27              RenderBlock {DIV} at (0,0) size 90x30 [bgcolor=#008000]
     28        RenderListItem {LI} at (40,67) size 744x18
     29          RenderListMarker at (-17,0) size 7x18: bullet
     30          RenderText {#text} at (0,0) size 64x18
     31            text run at (0,0) width 64: "Bar style: "
     32          RenderProgress {PROGRESS} at (64,1) size 160x16
     33            RenderBlock {DIV} at (0,0) size 160x16 [bgcolor=#FF0000] [border: (3px solid #990000)]
     34              RenderBlock {DIV} at (3,3) size 61x10 [bgcolor=#008000]
     35        RenderListItem {LI} at (40,85) size 744x18
     36          RenderListMarker at (-17,0) size 7x18: bullet
     37          RenderText {#text} at (0,0) size 79x18
     38            text run at (0,0) width 79: "Value style: "
     39          RenderProgress {PROGRESS} at (79,1) size 160x16
     40            RenderBlock {DIV} at (0,0) size 160x16 [bgcolor=#808080]
     41              RenderBlock {DIV} at (0,0) size 80x16 [bgcolor=#FFFF00] [border: (3px solid #999900)]
     42        RenderListItem {LI} at (40,103) size 744x31
     43          RenderListMarker at (-17,13) size 7x18: bullet
     44          RenderText {#text} at (0,13) size 188x18
     45            text run at (0,13) width 188: "Styling for all three elements: "
     46          RenderProgress {PROGRESS} at (188,0) size 160x30 [bgcolor=#0000FF] [border: (3px solid #000066)]
     47            RenderBlock {DIV} at (3,3) size 154x24 [bgcolor=#FF0000] [border: (3px solid #990000)]
     48              RenderBlock {DIV} at (3,3) size 88x18 [bgcolor=#FFFF00] [border: (3px solid #999900)]
     49        RenderListItem {LI} at (40,134) size 744x18
     50          RenderListMarker at (-17,0) size 7x18: bullet
     51          RenderText {#text} at (0,0) size 230x18
     52            text run at (0,0) width 230: "Removing appearance dynamically: "
     53          RenderProgress {PROGRESS} at (230,1) size 160x16
     54            RenderBlock {DIV} at (0,0) size 160x16 [bgcolor=#808080]
     55              RenderBlock {DIV} at (0,0) size 112x16 [bgcolor=#008000]
     56        RenderListItem {LI} at (40,152) size 744x18
     57          RenderListMarker at (-17,0) size 7x18: bullet
     58          RenderText {#text} at (0,0) size 272x18
     59            text run at (0,0) width 272: "Giving progress style change dynamically: "
     60          RenderProgress {PROGRESS} at (272,1) size 160x16 [bgcolor=#ADD8E6]
     61            RenderBlock {DIV} at (0,0) size 160x16
     62              RenderBlock {DIV} at (0,0) size 128x16 [bgcolor=#008000]
  • trunk/Source/WebCore/Android.mk

    r82899 r83065  
    357357        html/shadow/MediaControls.cpp \
    358358        html/shadow/MeterShadowElement.cpp \
     359        html/shadow/ProgressShadowElement.cpp \
    359360        html/shadow/SliderThumbElement.cpp \
    360361        html/shadow/TextControlInnerElements.cpp \
  • trunk/Source/WebCore/CMakeLists.txt

    r82899 r83065  
    876876    html/shadow/MediaControls.cpp
    877877    html/shadow/MeterShadowElement.cpp
     878    html/shadow/ProgressShadowElement.cpp
    878879    html/shadow/SliderThumbElement.cpp
    879880    html/shadow/TextControlInnerElements.cpp
  • trunk/Source/WebCore/ChangeLog

    r83064 r83065  
     12011-04-06  MORITA Hajime  <morrita@google.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        [Refactoring] <progress> should not have manual layout code.
     6        https://bugs.webkit.org/show_bug.cgi?id=57801
     7
     8        - Simplified RenderProgress, removing its custom layout code
     9        - Introducing ProgressValueElement and ProgressBarElement, replacing
     10          ProgressBarValueElement.
     11       
     12        Now the structure is almost identical to <meter>,
     13        other than:
     14        - RenderProgress has animated painting, thus manages its own timer.
     15        - Both ProgressValueElement and ProgressBarElement has pseudo classes
     16          which don't changes during its lifetime.
     17       
     18        * Android.mk:
     19        * CMakeLists.txt:
     20        * GNUmakefile.am:
     21        * WebCore.gypi:
     22        * WebCore.pro:
     23        * WebCore.vcproj/WebCore.vcproj:
     24        * WebCore.xcodeproj/project.pbxproj:
     25        * css/html.css:
     26        (progress):
     27        (progress::-webkit-progress-bar):
     28        (progress::-webkit-progress-value):
     29        * html/HTMLProgressElement.cpp:
     30        (WebCore::HTMLProgressElement::~HTMLProgressElement):
     31        (WebCore::HTMLProgressElement::create):
     32        (WebCore::HTMLProgressElement::attach):
     33        (WebCore::HTMLProgressElement::didElementStateChange):
     34        (WebCore::HTMLProgressElement::createShadowSubtree):
     35        * html/HTMLProgressElement.h:
     36        * html/shadow/ProgressShadowElement.cpp: Copied from Source/WebCore/html/shadow/ProgressBarValueElement.h.
     37        (WebCore::ProgressShadowElement::ProgressShadowElement):
     38        (WebCore::ProgressShadowElement::progressElement):
     39        (WebCore::ProgressShadowElement::rendererIsNeeded):
     40        (WebCore::ProgressBarElement::shadowPseudoId):
     41        (WebCore::ProgressValueElement::shadowPseudoId):
     42        (WebCore::ProgressValueElement::setWidthPercentage):
     43        * html/shadow/ProgressShadowElement.h: Renamed from Source/WebCore/html/shadow/ProgressBarValueElement.h.
     44        (WebCore::ProgressBarElement::ProgressBarElement):
     45        (WebCore::ProgressBarElement::create):
     46        (WebCore::ProgressValueElement::ProgressValueElement):
     47        (WebCore::ProgressValueElement::create):
     48        * rendering/RenderProgress.cpp:
     49        (WebCore::RenderProgress::RenderProgress):
     50        (WebCore::RenderProgress::updateFromElement):
     51        (WebCore::RenderProgress::animationTimerFired):
     52        * rendering/RenderProgress.h:
     53        (WebCore::RenderProgress::requiresForcedStyleRecalcPropagation):
     54        (WebCore::RenderProgress::canHaveChildren):
     55
    1562011-04-06  Mario Sanchez Prada  <msanchez@igalia.com>
    257
  • trunk/Source/WebCore/GNUmakefile.am

    r83053 r83065  
    19261926        Source/WebCore/html/shadow/MeterShadowElement.cpp \
    19271927        Source/WebCore/html/shadow/MeterShadowElement.h \
    1928         Source/WebCore/html/shadow/ProgressBarValueElement.h \
     1928        Source/WebCore/html/shadow/ProgressShadowElement.cpp \
     1929        Source/WebCore/html/shadow/ProgressShadowElement.h \
    19291930        Source/WebCore/html/shadow/SliderThumbElement.cpp \
    19301931        Source/WebCore/html/shadow/SliderThumbElement.h \
  • trunk/Source/WebCore/WebCore.gypi

    r82963 r83065  
    31523152            'html/shadow/MeterShadowElement.cpp',
    31533153            'html/shadow/MeterShadowElement.h',
    3154             'html/shadow/ProgressBarValueElement.h',
     3154            'html/shadow/ProgressShadowElement.cpp',
     3155            'html/shadow/ProgressShadowElement.h',
    31553156            'html/shadow/SliderThumbElement.cpp',
    31563157            'html/shadow/SliderThumbElement.h',
  • trunk/Source/WebCore/WebCore.pro

    r82899 r83065  
    803803    html/shadow/MediaControls.cpp \
    804804    html/shadow/MeterShadowElement.cpp \
     805    html/shadow/ProgressShadowElement.cpp \
    805806    html/shadow/SliderThumbElement.cpp \
    806807    html/shadow/TextControlInnerElements.cpp \
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r82962 r83065  
    5640656406                                </File>
    5640756407                                <File
     56408                                        RelativePath="..\html\shadow\ProgressShadowElement.cpp"
     56409                                        >
     56410                                </File>
     56411                                <File
     56412                                        RelativePath="..\html\shadow\ProgressShadowElement.h"
     56413                                        >
     56414                                </File>
     56415                                <File
    5640856416                                        RelativePath="..\html\shadow\SliderThumbElement.cpp"
    5640956417                                        >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r83040 r83065  
    31983198                A622A8FF122C44A600A785B3 /* GenericBinding.h in Headers */ = {isa = PBXBuildFile; fileRef = A622A8F9122C44A600A785B3 /* GenericBinding.h */; };
    31993199                A7151BD812F1558F005A0F64 /* TextCheckerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A7151BD712F1558F005A0F64 /* TextCheckerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
     3200                A715E652134BBBEC00D8E713 /* ProgressShadowElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A715E650134BBBEC00D8E713 /* ProgressShadowElement.cpp */; };
     3201                A715E653134BBBEC00D8E713 /* ProgressShadowElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A715E651134BBBEC00D8E713 /* ProgressShadowElement.h */; };
    32003202                A718760E0B2A120100A16ECE /* DragActions.h in Headers */ = {isa = PBXBuildFile; fileRef = A718760D0B2A120100A16ECE /* DragActions.h */; settings = {ATTRIBUTES = (Private, ); }; };
    32013203                A71878900B2D04AC00A16ECE /* DragControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */; };
     
    32513253                A7F338A311C0EFCA00A320A7 /* ShadowElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7F338A111C0EFCA00A320A7 /* ShadowElement.cpp */; };
    32523254                A7F338A411C0EFCA00A320A7 /* ShadowElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A7F338A211C0EFCA00A320A7 /* ShadowElement.h */; };
    3253                 A7FE819C12FA677700850C1E /* ProgressBarValueElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A7FE819B12FA677700850C1E /* ProgressBarValueElement.h */; };
    32543255                A80A38FE0E50CC8200A25EBC /* PatternCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A80A38FD0E50CC8200A25EBC /* PatternCG.cpp */; };
    32553256                A80D67080E9E9DEB00E420F0 /* GraphicsContextPlatformPrivateCG.h in Headers */ = {isa = PBXBuildFile; fileRef = A80D67070E9E9DEB00E420F0 /* GraphicsContextPlatformPrivateCG.h */; };
     
    97239724                A622A8F9122C44A600A785B3 /* GenericBinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GenericBinding.h; path = generic/GenericBinding.h; sourceTree = "<group>"; };
    97249725                A7151BD712F1558F005A0F64 /* TextCheckerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCheckerClient.h; sourceTree = "<group>"; };
     9726                A715E650134BBBEC00D8E713 /* ProgressShadowElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProgressShadowElement.cpp; sourceTree = "<group>"; };
     9727                A715E651134BBBEC00D8E713 /* ProgressShadowElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProgressShadowElement.h; sourceTree = "<group>"; };
    97259728                A718760D0B2A120100A16ECE /* DragActions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragActions.h; sourceTree = "<group>"; };
    97269729                A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DragControllerMac.mm; sourceTree = "<group>"; };
     
    97799782                A7F338A111C0EFCA00A320A7 /* ShadowElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShadowElement.cpp; sourceTree = "<group>"; };
    97809783                A7F338A211C0EFCA00A320A7 /* ShadowElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowElement.h; sourceTree = "<group>"; };
    9781                 A7FE819B12FA677700850C1E /* ProgressBarValueElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProgressBarValueElement.h; sourceTree = "<group>"; };
    97829784                A80A38FD0E50CC8200A25EBC /* PatternCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PatternCG.cpp; sourceTree = "<group>"; };
    97839785                A80D67070E9E9DEB00E420F0 /* GraphicsContextPlatformPrivateCG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsContextPlatformPrivateCG.h; sourceTree = "<group>"; };
     
    1344213444                                A78E526D1346BD1700AD9C31 /* MeterShadowElement.cpp */,
    1344313445                                A78E526E1346BD1700AD9C31 /* MeterShadowElement.h */,
    13444                                 A7FE819B12FA677700850C1E /* ProgressBarValueElement.h */,
     13446                                A715E650134BBBEC00D8E713 /* ProgressShadowElement.cpp */,
     13447                                A715E651134BBBEC00D8E713 /* ProgressShadowElement.h */,
    1344513448                                4150F9F012B6E0E70008C860 /* SliderThumbElement.cpp */,
    1344613449                                4150F9EF12B6E0E70008C860 /* SliderThumbElement.h */,
     
    2200322006                                B71FE6DF11091CB300DAEF77 /* PrintContext.h in Headers */,
    2200422007                                A8EA7EBC0A1945D000A8EF5F /* ProcessingInstruction.h in Headers */,
    22005                                 A7FE819C12FA677700850C1E /* ProgressBarValueElement.h in Headers */,
    2200622008                                E44613EC0CD681B500FADA75 /* ProgressEvent.h in Headers */,
     22009                                A715E653134BBBEC00D8E713 /* ProgressShadowElement.h in Headers */,
    2200722010                                1A2A68240B5BEDE70002A480 /* ProgressTracker.h in Headers */,
    2200822011                                514C76750CE923A1007EF3CD /* ProtectionSpace.h in Headers */,
     
    2486024863                                A8EA7EBD0A1945D000A8EF5F /* ProcessingInstruction.cpp in Sources */,
    2486124864                                E44613EB0CD681B400FADA75 /* ProgressEvent.cpp in Sources */,
     24865                                A715E652134BBBEC00D8E713 /* ProgressShadowElement.cpp in Sources */,
    2486224866                                1A2A68230B5BEDE70002A480 /* ProgressTracker.cpp in Sources */,
    2486324867                                514C76740CE923A1007EF3CD /* ProtectionSpace.cpp in Sources */,
  • trunk/Source/WebCore/css/html.css

    r82899 r83065  
    709709progress {
    710710    -webkit-appearance: progress-bar;
     711    -webkit-box-sizing: border-box;
    711712    display: inline-block;
    712713    height: 1em;
    713714    width: 10em;
    714715    vertical-align: -0.2em;
     716}
     717
     718progress::-webkit-progress-bar {
    715719    background-color: gray;
    716 }
    717 
    718 progress::-webkit-progress-bar-value {
    719     -webkit-appearance: progress-bar;
     720    height: 100%;
     721    -webkit-box-sizing: border-box;
     722}
     723
     724progress::-webkit-progress-value {
    720725    background-color: green;
     726    height: 100%;
     727    width: 50%; /* should be removed later */
     728    -webkit-box-sizing: border-box;
    721729}
    722730
  • trunk/Source/WebCore/html/HTMLProgressElement.cpp

    r77578 r83065  
    3131#include "HTMLNames.h"
    3232#include "HTMLParserIdioms.h"
    33 #include "ProgressBarValueElement.h"
     33#include "ProgressShadowElement.h"
    3434#include "RenderProgress.h"
    3535#include <wtf/StdLibExtras.h>
     
    4545}
    4646
     47HTMLProgressElement::~HTMLProgressElement()
     48{
     49}
     50
    4751PassRefPtr<HTMLProgressElement> HTMLProgressElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
    4852{
    49     return adoptRef(new HTMLProgressElement(tagName, document, form));
     53    RefPtr<HTMLProgressElement> progress = adoptRef(new HTMLProgressElement(tagName, document, form));
     54    progress->createShadowSubtree();
     55    return progress;
    5056}
    5157
     
    7379void HTMLProgressElement::attach()
    7480{
    75     createShadowSubtreeIfNeeded();
    7681    HTMLFormControlElement::attach();
    7782    didElementStateChange();
     
    124129void HTMLProgressElement::didElementStateChange()
    125130{
     131    m_value->setWidthPercentage(position()*100);
    126132    if (renderer())
    127133        renderer()->updateFromElement();
    128134}
    129135
    130 void HTMLProgressElement::createShadowSubtreeIfNeeded()
     136void HTMLProgressElement::createShadowSubtree()
    131137{
    132     if (shadowRoot())
    133         return;
    134     setShadowRoot(ProgressBarValueElement::create(document()).get());
     138    RefPtr<ProgressBarElement> bar = ProgressBarElement::create(document());
     139    m_value = ProgressValueElement::create(document());
     140    ExceptionCode e = 0;
     141    bar->appendChild(m_value, e);
     142    setShadowRoot(bar);
    135143}
    136144
  • trunk/Source/WebCore/html/HTMLProgressElement.h

    r78232 r83065  
    2727namespace WebCore {
    2828
     29class ProgressValueElement;
     30
    2931class HTMLProgressElement : public HTMLFormControlElement {
    3032public:
     
    4143private:
    4244    HTMLProgressElement(const QualifiedName&, Document*, HTMLFormElement*);
     45    virtual ~HTMLProgressElement();
    4346
    4447    virtual bool recalcWillValidate() const { return false; }
     
    5356
    5457    void didElementStateChange();
    55     void createShadowSubtreeIfNeeded();
     58    void createShadowSubtree();
     59
     60    RefPtr<ProgressValueElement> m_value;
    5661};
    5762
  • trunk/Source/WebCore/html/shadow/ProgressShadowElement.cpp

    r83064 r83065  
    11/*
    2  * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
    3  * Copyright (C) 2010 Google Inc. All rights reserved.
     2 * Copyright (C) 2011 Google Inc. All rights reserved.
    43 *
    54 * Redistribution and use in source and binary forms, with or without
     
    3029 */
    3130
    32 #ifndef ProgressBarValueElement_h
    33 #define ProgressBarValueElement_h
     31#include "config.h"
     32#if ENABLE(PROGRESS_TAG)
     33#include "ProgressShadowElement.h"
    3434
    35 #include "HTMLDivElement.h"
    3635#include "HTMLNames.h"
    37 #include "RenderProgress.h"
    38 #include <wtf/Forward.h>
     36#include "HTMLProgressElement.h"
     37#include "RenderObject.h"
    3938
    4039namespace WebCore {
    4140
    42 class ProgressBarValueElement : public HTMLDivElement {
    43 public:
    44     ProgressBarValueElement(Document* document)
    45         : HTMLDivElement(HTMLNames::divTag, document)
    46     {
    47     }
     41using namespace HTMLNames;
    4842
    49     virtual const AtomicString& shadowPseudoId() const;
    50     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
    51     static PassRefPtr<ProgressBarValueElement> create(Document*);
     43ProgressShadowElement::ProgressShadowElement(Document* document)
     44    : HTMLDivElement(HTMLNames::divTag, document)
     45{
     46}
    5247
    53 };
     48HTMLProgressElement* ProgressShadowElement::progressElement() const
     49{
     50    Node* node = const_cast<ProgressShadowElement*>(this)->shadowAncestorNode();
     51    ASSERT(!node || progressTag == toElement(node)->tagQName());
     52    return static_cast<HTMLProgressElement*>(node);
     53}
    5454
    55 inline const AtomicString& ProgressBarValueElement::shadowPseudoId() const
     55bool ProgressShadowElement::rendererIsNeeded(RenderStyle* style)
    5656{
    57     DEFINE_STATIC_LOCAL(AtomicString, pseudId, ("-webkit-progress-bar-value"));
     57    RenderObject* progressRenderer = progressElement()->renderer();
     58    return progressRenderer && !progressRenderer->style()->hasAppearance() && HTMLDivElement::rendererIsNeeded(style);
     59}
     60
     61const AtomicString& ProgressBarElement::shadowPseudoId() const
     62{
     63    DEFINE_STATIC_LOCAL(AtomicString, pseudId, ("-webkit-progress-bar"));
    5864    return pseudId;
    5965}
    6066
    61 inline RenderObject* ProgressBarValueElement::createRenderer(RenderArena* arena, RenderStyle*)
     67
     68const AtomicString& ProgressValueElement::shadowPseudoId() const
    6269{
    63     return new (arena) RenderProgressBarValuePart(this);
     70    DEFINE_STATIC_LOCAL(AtomicString, pseudId, ("-webkit-progress-value"));
     71    return pseudId;
    6472}
    6573
    66 inline PassRefPtr<ProgressBarValueElement> ProgressBarValueElement::create(Document* document)
     74void ProgressValueElement::setWidthPercentage(double width)
    6775{
    68     return adoptRef(new ProgressBarValueElement(document));
     76    getInlineStyleDecl()->setProperty(CSSPropertyWidth, width, CSSPrimitiveValue::CSS_PERCENTAGE);
    6977}
    7078
    7179}
     80#endif
    7281
    73 #endif
  • trunk/Source/WebCore/html/shadow/ProgressShadowElement.h

    r83064 r83065  
    3030 */
    3131
    32 #ifndef ProgressBarValueElement_h
    33 #define ProgressBarValueElement_h
     32#ifndef ProgressShadowElement_h
     33#define ProgressShadowElement_h
    3434
    3535#include "HTMLDivElement.h"
    36 #include "HTMLNames.h"
    37 #include "RenderProgress.h"
    3836#include <wtf/Forward.h>
    3937
    4038namespace WebCore {
    4139
    42 class ProgressBarValueElement : public HTMLDivElement {
     40class HTMLProgressElement;
     41
     42class ProgressShadowElement : public HTMLDivElement {
    4343public:
    44     ProgressBarValueElement(Document* document)
    45         : HTMLDivElement(HTMLNames::divTag, document)
     44    ProgressShadowElement(Document*);
     45    HTMLProgressElement* progressElement() const;
     46
     47private:
     48    virtual bool rendererIsNeeded(RenderStyle*);
     49};
     50
     51class ProgressBarElement : public ProgressShadowElement {
     52public:
     53    ProgressBarElement(Document* document)
     54        : ProgressShadowElement(document)
     55    {
     56    }
     57
     58    static PassRefPtr<ProgressBarElement> create(Document*);
     59    virtual const AtomicString& shadowPseudoId() const;
     60};
     61
     62inline PassRefPtr<ProgressBarElement> ProgressBarElement::create(Document* document)
     63{
     64    return adoptRef(new ProgressBarElement(document));
     65}
     66
     67
     68class ProgressValueElement : public ProgressShadowElement {
     69public:
     70    ProgressValueElement(Document* document)
     71        : ProgressShadowElement(document)
    4672    {
    4773    }
    4874
    4975    virtual const AtomicString& shadowPseudoId() const;
    50     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
    51     static PassRefPtr<ProgressBarValueElement> create(Document*);
    52 
     76    static PassRefPtr<ProgressValueElement> create(Document*);
     77    void setWidthPercentage(double);
    5378};
    5479
    55 inline const AtomicString& ProgressBarValueElement::shadowPseudoId() const
     80inline PassRefPtr<ProgressValueElement> ProgressValueElement::create(Document* document)
    5681{
    57     DEFINE_STATIC_LOCAL(AtomicString, pseudId, ("-webkit-progress-bar-value"));
    58     return pseudId;
    59 }
    60 
    61 inline RenderObject* ProgressBarValueElement::createRenderer(RenderArena* arena, RenderStyle*)
    62 {
    63     return new (arena) RenderProgressBarValuePart(this);
    64 }
    65 
    66 inline PassRefPtr<ProgressBarValueElement> ProgressBarValueElement::create(Document* document)
    67 {
    68     return adoptRef(new ProgressBarValueElement(document));
     82    return adoptRef(new ProgressValueElement(document));
    6983}
    7084
  • trunk/Source/WebCore/rendering/RenderProgress.cpp

    r77578 r83065  
    3737namespace WebCore {
    3838
    39 IntRect RenderProgressBarValuePart::preferredFrameRect()
    40 {
    41     return toRenderProgress(parent())->valuePartRect();
    42 }
    43 
    44 bool RenderProgressBarValuePart::shouldBeHidden()
    45 {
    46     return !toRenderProgress(parent())->shouldHaveParts();
    47 }
    48 
    4939RenderProgress::RenderProgress(HTMLProgressElement* element)
    50     : RenderIndicator(element)
     40    : RenderBlock(element)
    5141    , m_position(-1)
    5242    , m_animationStartTime(0)
     
    7060
    7161    updateAnimationState();
    72     RenderIndicator::updateFromElement();
     62    RenderBlock::updateFromElement();
    7363}
    7464
     
    8676{
    8777    repaint();
    88 }
    89 
    90 void RenderProgress::paint(PaintInfo& paintInfo, int tx, int ty)
    91 {
    92     if (paintInfo.phase == PaintPhaseBlockBackground) {
    93         if (!m_animationTimer.isActive() && m_animating)
    94             m_animationTimer.startOneShot(m_animationRepeatInterval);
    95     }
    96 
    97     RenderIndicator::paint(paintInfo, tx, ty);
    98 }
    99 
    100 void RenderProgress::layoutParts()
    101 {
    102     for (RenderObject* child = firstChild(); child; child = child->nextSibling())
    103         child->layout();
    104     updateAnimationState();
    105 }
    106 
    107 bool RenderProgress::shouldHaveParts() const
    108 {
    109     if (!style()->hasAppearance())
    110         return true;
    111     return false;
     78    if (!m_animationTimer.isActive() && m_animating)
     79        m_animationTimer.startOneShot(m_animationRepeatInterval);
    11280}
    11381
     
    12997}
    13098
    131 IntRect RenderProgress::valuePartRect() const
    132 {
    133     IntRect rect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), lround((width() - borderLeft() - paddingLeft() - borderRight() - paddingRight()) * position()), height()  - borderTop() - paddingTop() - borderBottom() - paddingBottom());
    134     if (!style()->isLeftToRightDirection())
    135         rect.setX(width() - borderRight() - paddingRight() - rect.width());
    136     return rect;
    137 }
    138 
    13999HTMLProgressElement* RenderProgress::progressElement() const
    140100{
  • trunk/Source/WebCore/rendering/RenderProgress.h

    r77578 r83065  
    2424#if ENABLE(PROGRESS_TAG)
    2525#include "RenderBlock.h"
    26 #include "RenderIndicator.h"
    2726
    2827namespace WebCore {
     
    3029class HTMLProgressElement;
    3130
    32 class RenderProgressBarValuePart : public RenderIndicatorPart {
    33 public:
    34     RenderProgressBarValuePart(Node* node) : RenderIndicatorPart(node) {}
    35 private:
    36     virtual IntRect preferredFrameRect();
    37     virtual bool shouldBeHidden();
    38 };
    39 
    40 class RenderProgress : public RenderIndicator {
     31class RenderProgress : public RenderBlock {
    4132public:
    4233    RenderProgress(HTMLProgressElement*);
     
    4839
    4940    bool isDeterminate() const;
    50     IntRect valuePartRect() const;
    51     bool shouldHaveParts() const;
    5241
    5342    HTMLProgressElement* progressElement() const;
     
    5645    virtual const char* renderName() const { return "RenderProgress"; }
    5746    virtual bool isProgress() const { return true; }
     47    virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
     48    virtual bool canHaveChildren() const { return false; }
    5849    virtual void updateFromElement();
    59     virtual void paint(PaintInfo&, int tx, int ty);
    60     virtual void layoutParts();
    6150
    6251    void animationTimerFired(Timer<RenderProgress>*);
Note: See TracChangeset for help on using the changeset viewer.