2011-02-02 MORITA Hajime <morrita@google.com>
authormorrita@google.com <morrita@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Feb 2011 01:45:55 +0000 (01:45 +0000)
committermorrita@google.com <morrita@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Feb 2011 01:45:55 +0000 (01:45 +0000)
        Reviewed by Dimitri Glazkov.

        Refactoring: <progress> should not use ShadowElement
        https://bugs.webkit.org/show_bug.cgi?id=53583

        Updated to catch the change on -webkit-progress-bar-value interpretation.

        * fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element.html:
2011-02-02  MORITA Hajime  <morrita@google.com>

        Reviewed by Dimitri Glazkov.

        Refactoring: <progress> should not use ShadowElement
        https://bugs.webkit.org/show_bug.cgi?id=53583

        - Introduced RenderIndicatorPart and RenderProgressBarValuePart
          to be responsible for bar-part layout,
          which adopted layout logic from ShadowBlockElement.
        - ProgressBarValueElement is no longer a subclass of ShadowBlockElement.
        - Remove dependency from RenderProgress to HTMLProgressElement and
          ShadowBlockElement.
        - The shadow tree is no longer removed on detach(). It becomes persistent.
          This is now possible because the ShadowBlockElement dependency is gone.
        - ::-webkit-appearance for -webkit-progress-bar-value is no longer referred.
          That didn't make sense.

        * html/HTMLProgressElement.cpp:
        (WebCore::HTMLProgressElement::createShadowSubtreeIfNeeded):
        * html/HTMLProgressElement.h:
        * html/shadow/ProgressBarValueElement.h: Added.
        (WebCore::ProgressBarValueElement::ProgressBarValueElement):
        (WebCore::ProgressBarValueElement::shadowPseudoId):
        (WebCore::ProgressBarValueElement::createRenderer):
        (WebCore::ProgressBarValueElement::create):
        * rendering/RenderIndicator.cpp:
        (WebCore::RenderIndicatorPart::RenderIndicatorPart):
        (WebCore::RenderIndicatorPart::~RenderIndicatorPart):
        (WebCore::RenderIndicatorPart::layout):
        (WebCore::RenderIndicatorPart::styleDidChange):
        * rendering/RenderIndicator.h: Added RenderIndicatorPart class
        (WebCore::RenderIndicatorPart::originalVisibility):
        (WebCore::RenderIndicatorPart::requiresForcedStyleRecalcPropagation):
        (WebCore::RenderIndicatorPart::canHaveChildren):
        * rendering/RenderProgress.cpp:
        (WebCore::RenderProgressBarValuePart::preferredFrameRect):
        (WebCore::RenderProgressBarValuePart::shouldBeHidden):
        (WebCore::RenderProgress::updateFromElement):
        (WebCore::RenderProgress::layoutParts):
        (WebCore::RenderProgress::shouldHaveParts):
        * rendering/RenderProgress.h:
        (WebCore::RenderProgressBarValuePart::RenderProgressBarValuePart):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77578 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element.html
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.am
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/html/HTMLProgressElement.cpp
Source/WebCore/html/HTMLProgressElement.h
Source/WebCore/html/shadow/ProgressBarValueElement.h [new file with mode: 0644]
Source/WebCore/rendering/RenderIndicator.cpp
Source/WebCore/rendering/RenderIndicator.h
Source/WebCore/rendering/RenderProgress.cpp
Source/WebCore/rendering/RenderProgress.h

index d3bb7a181a4b41c1164ecae64da82bec8cbcad2d..656f79c1aee8cbabd97761a6e80b823af32c7c99 100644 (file)
@@ -1,3 +1,14 @@
+2011-02-02  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Dimitri Glazkov.
+
+        Refactoring: <progress> should not use ShadowElement
+        https://bugs.webkit.org/show_bug.cgi?id=53583
+
+        Updated to catch the change on -webkit-progress-bar-value interpretation.
+
+        * fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element.html:
+
 2011-02-03  Jia Pu  <jpu@apple.com>
 
         Reversion should not be marked as misspelled.
index 1b3d3bf551812c5f234b20b4364f8be7a4784349..436a8130ecb977908f4c75aff901fff431e271e1 100644 (file)
@@ -2,13 +2,13 @@
 <head><script>
 window.onload = function() {
     document.getElementById("toChangeStyle").setAttribute("style", "border:3px red dotted; background-color:cyan;");
-    document.getElementById("toAddStyle").setAttribute("style", "border:3px red dotted; background-color:cyan;");
+    document.getElementById("toAddStyle").setAttribute("style", "border:3px red dotted; background-color:cyan; -webkit-appearance: none;");
 }
 </script>
 <style>
-.styled::-webkit-progress-bar-value {background-color: lightgray;}
+.styled { -webkit-appearance: none; }
+.styled::-webkit-progress-bar-value { background-color: lightgray; }
 #toAddStyle::-webkit-progress-bar-value {background-color:darkblue;}
-.no-appearance {-webkit-appearance: none;}
 </style>
 </head>
 <body>
index 3635ab275effcf3b94bc8ce9e3469b4ff5a3b66f..bd2c1d647d715f6f92cf340d22d745a7094c40c1 100644 (file)
@@ -1,3 +1,47 @@
+2011-02-02  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Dimitri Glazkov.
+
+        Refactoring: <progress> should not use ShadowElement
+        https://bugs.webkit.org/show_bug.cgi?id=53583
+
+        - Introduced RenderIndicatorPart and RenderProgressBarValuePart
+          to be responsible for bar-part layout,
+          which adopted layout logic from ShadowBlockElement.
+        - ProgressBarValueElement is no longer a subclass of ShadowBlockElement.
+        - Remove dependency from RenderProgress to HTMLProgressElement and
+          ShadowBlockElement.
+        - The shadow tree is no longer removed on detach(). It becomes persistent.
+          This is now possible because the ShadowBlockElement dependency is gone.
+        - ::-webkit-appearance for -webkit-progress-bar-value is no longer referred.
+          That didn't make sense.
+
+        * html/HTMLProgressElement.cpp:
+        (WebCore::HTMLProgressElement::createShadowSubtreeIfNeeded):
+        * html/HTMLProgressElement.h:
+        * html/shadow/ProgressBarValueElement.h: Added.
+        (WebCore::ProgressBarValueElement::ProgressBarValueElement):
+        (WebCore::ProgressBarValueElement::shadowPseudoId):
+        (WebCore::ProgressBarValueElement::createRenderer):
+        (WebCore::ProgressBarValueElement::create):
+        * rendering/RenderIndicator.cpp:
+        (WebCore::RenderIndicatorPart::RenderIndicatorPart):
+        (WebCore::RenderIndicatorPart::~RenderIndicatorPart):
+        (WebCore::RenderIndicatorPart::layout):
+        (WebCore::RenderIndicatorPart::styleDidChange):
+        * rendering/RenderIndicator.h: Added RenderIndicatorPart class
+        (WebCore::RenderIndicatorPart::originalVisibility):
+        (WebCore::RenderIndicatorPart::requiresForcedStyleRecalcPropagation):
+        (WebCore::RenderIndicatorPart::canHaveChildren):
+        * rendering/RenderProgress.cpp:
+        (WebCore::RenderProgressBarValuePart::preferredFrameRect):
+        (WebCore::RenderProgressBarValuePart::shouldBeHidden):
+        (WebCore::RenderProgress::updateFromElement):
+        (WebCore::RenderProgress::layoutParts):
+        (WebCore::RenderProgress::shouldHaveParts):
+        * rendering/RenderProgress.h:
+        (WebCore::RenderProgressBarValuePart::RenderProgressBarValuePart):
+
 2011-02-03  Jia Pu  <jpu@apple.com>
 
         Reversion should not be marked as misspelled.
index 1697f243eccdd91eb335bd4cc305b5760e98986f..a0c59db69960ae3d9f70819f7d62de70373af4ac 100644 (file)
@@ -1887,6 +1887,7 @@ webcore_sources += \
        Source/WebCore/html/shadow/MediaControls.h \
        Source/WebCore/html/shadow/SliderThumbElement.cpp \
        Source/WebCore/html/shadow/SliderThumbElement.h \
+       Source/WebCore/html/shadow/ProgressBarValueElement.h \
        Source/WebCore/html/PasswordInputType.cpp \
        Source/WebCore/html/PasswordInputType.h \
        Source/WebCore/html/PluginDocument.cpp \
index 8638ea4ccdeb98f6c4d6bac04a32459b9ad12e2a..213eba34038f4ccb4642111ab9c7a81a051027ed 100644 (file)
             'html/parser/XSSFilter.h',
             'html/shadow/MediaControls.cpp',
             'html/shadow/MediaControls.h',
+            'html/shadow/ProgressBarValueElement.h',
             'html/shadow/SliderThumbElement.cpp',
             'html/shadow/SliderThumbElement.h',
             'inspector/ConsoleMessage.cpp',
index 4d2f637d92e98fa2acc306c3e7568cd1c6dcc4dd..6b7273351077b1de7c23ab79f987691aefcbe9df 100755 (executable)
                                        RelativePath="..\html\shadow\MediaControls.h"
                                        >
                                </File>
+                               <File
+                                       RelativePath="..\html\shadow\ProgressBarValueElement.h"
+                                       >
+                               </File>
                                <File
                                        RelativePath="..\html\shadow\SliderThumbElement.cpp"
                                        >
index 842513704a019848e78625bff5bf35715f7b20a0..34b72e55594d5cbd4fee92df7e82d04bcbba7ac6 100644 (file)
                A7DBF8DE1276919C006B6008 /* TextCheckingHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = A7DBF8DC1276919C006B6008 /* TextCheckingHelper.h */; };
                A7F338A311C0EFCA00A320A7 /* ShadowElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7F338A111C0EFCA00A320A7 /* ShadowElement.cpp */; };
                A7F338A411C0EFCA00A320A7 /* ShadowElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A7F338A211C0EFCA00A320A7 /* ShadowElement.h */; };
+               A7FE819C12FA677700850C1E /* ProgressBarValueElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A7FE819B12FA677700850C1E /* ProgressBarValueElement.h */; };
                A80A38FE0E50CC8200A25EBC /* PatternCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A80A38FD0E50CC8200A25EBC /* PatternCG.cpp */; };
                A80D67080E9E9DEB00E420F0 /* GraphicsContextPlatformPrivateCG.h in Headers */ = {isa = PBXBuildFile; fileRef = A80D67070E9E9DEB00E420F0 /* GraphicsContextPlatformPrivateCG.h */; };
                A80E6CE40A1989CA007FB8C5 /* CSSValueList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A80E6CBA0A1989CA007FB8C5 /* CSSValueList.cpp */; };
                A7DBF8DC1276919C006B6008 /* TextCheckingHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCheckingHelper.h; sourceTree = "<group>"; };
                A7F338A111C0EFCA00A320A7 /* ShadowElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShadowElement.cpp; sourceTree = "<group>"; };
                A7F338A211C0EFCA00A320A7 /* ShadowElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowElement.h; sourceTree = "<group>"; };
+               A7FE819B12FA677700850C1E /* ProgressBarValueElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProgressBarValueElement.h; sourceTree = "<group>"; };
                A80A38FD0E50CC8200A25EBC /* PatternCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PatternCG.cpp; sourceTree = "<group>"; };
                A80D67070E9E9DEB00E420F0 /* GraphicsContextPlatformPrivateCG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsContextPlatformPrivateCG.h; sourceTree = "<group>"; };
                A80E6CBA0A1989CA007FB8C5 /* CSSValueList.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSValueList.cpp; sourceTree = "<group>"; };
                        children = (
                                4157AF7F12F1FB0400A8C6F5 /* MediaControls.cpp */,
                                4157AF7E12F1FB0400A8C6F5 /* MediaControls.h */,
+                               A7FE819B12FA677700850C1E /* ProgressBarValueElement.h */,
                                4150F9F012B6E0E70008C860 /* SliderThumbElement.cpp */,
                                4150F9EF12B6E0E70008C860 /* SliderThumbElement.h */,
                        );
                                BCE4413612F7490B009B84B8 /* FontWidthVariant.h in Headers */,
                                14947FFE12F80CD200A0F631 /* DocumentOrderedMap.h in Headers */,
                                97C471DC12F925BD0086354B /* ContentSecurityPolicy.h in Headers */,
+                               A7FE819C12FA677700850C1E /* ProgressBarValueElement.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 7824fa86bf7e789c5bc8278f7233a021424029fc..cab04290e4cf0b707922bcdc69a5eaa38a89ce35 100644 (file)
 #include "EventNames.h"
 #include "ExceptionCode.h"
 #include "FormDataList.h"
+#include "HTMLDivElement.h"
 #include "HTMLFormElement.h"
 #include "HTMLNames.h"
 #include "HTMLParserIdioms.h"
+#include "ProgressBarValueElement.h"
 #include "RenderProgress.h"
-#include "ShadowElement.h"
 #include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
 using namespace HTMLNames;
 
-class ProgressBarValueElement : public ShadowBlockElement {
-public:
-    ProgressBarValueElement(HTMLElement* shadowParent) 
-        : ShadowBlockElement(shadowParent)
-    {
-    }
-
-    virtual const AtomicString& shadowPseudoId() const
-    {
-        DEFINE_STATIC_LOCAL(AtomicString, pseudId, ("-webkit-progress-bar-value"));
-        return pseudId;
-    }
-
-    virtual void detach()
-    {
-        // Instead of using setShadowHost() like ShadowBlockElement does,
-        // this class uses setShadowRoot() to unlink mutual shadow-host references.
-        // Note that ShadowBlockElement::detach() should be removed when the
-        // shadow model transition is over. (Bug 53417)
-        if (Element* host = shadowHost())
-            host->setShadowRoot(0);
-        ShadowBlockElement::setShadowHost(0);
-    }
-
-    static PassRefPtr<ProgressBarValueElement> create(HTMLElement* shadowParent)
-    {
-        return adoptRef(new ProgressBarValueElement(shadowParent));
-    }
-
-};
-
 HTMLProgressElement::HTMLProgressElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
     : HTMLFormControlElement(tagName, document, form)
 {
@@ -151,11 +121,6 @@ double HTMLProgressElement::position() const
     return value() / max();
 }
 
-ShadowBlockElement* HTMLProgressElement::valuePart()
-{
-    return static_cast<ShadowBlockElement*>(shadowRoot());
-}
-
 void HTMLProgressElement::didElementStateChange()
 {
     if (renderer())
@@ -166,7 +131,7 @@ void HTMLProgressElement::createShadowSubtreeIfNeeded()
 {
     if (shadowRoot())
         return;
-    setShadowRoot(ProgressBarValueElement::create(this).get());
+    setShadowRoot(ProgressBarValueElement::create(document()).get());
 }
 
 } // namespace
index 3f43cd986c9477aa43a0deb070bef78348ff7988..a0db9662bf0b2e60f0e147f5b3af40a669f7f334 100644 (file)
@@ -26,8 +26,6 @@
 
 namespace WebCore {
 
-class ShadowBlockElement;
-
 class HTMLProgressElement : public HTMLFormControlElement {
 public:
     static PassRefPtr<HTMLProgressElement> create(const QualifiedName&, Document*, HTMLFormElement*);
@@ -40,7 +38,6 @@ public:
 
     double position() const;
 
-    ShadowBlockElement* valuePart();
 private:
     HTMLProgressElement(const QualifiedName&, Document*, HTMLFormElement*);
 
diff --git a/Source/WebCore/html/shadow/ProgressBarValueElement.h b/Source/WebCore/html/shadow/ProgressBarValueElement.h
new file mode 100644 (file)
index 0000000..22f4e57
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ProgressBarValueElement_h
+#define ProgressBarValueElement_h
+
+#include "HTMLDivElement.h"
+#include "HTMLNames.h"
+#include "RenderProgress.h"
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class ProgressBarValueElement : public HTMLDivElement {
+public:
+    ProgressBarValueElement(Document* document) 
+        : HTMLDivElement(HTMLNames::divTag, document)
+    {
+    }
+
+    virtual const AtomicString& shadowPseudoId() const;
+    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+    static PassRefPtr<ProgressBarValueElement> create(Document*);
+
+};
+
+inline const AtomicString& ProgressBarValueElement::shadowPseudoId() const
+{
+    DEFINE_STATIC_LOCAL(AtomicString, pseudId, ("-webkit-progress-bar-value"));
+    return pseudId;
+}
+
+inline RenderObject* ProgressBarValueElement::createRenderer(RenderArena* arena, RenderStyle*)
+{
+    return new (arena) RenderProgressBarValuePart(this);
+}
+
+inline PassRefPtr<ProgressBarValueElement> ProgressBarValueElement::create(Document* document)
+{
+    return adoptRef(new ProgressBarValueElement(document));
+}
+
+}
+
+#endif
index b03dfbabaedc39119b0e172e71eff2a0f536002b..8f34a408730cc1cebb6feb2725102b136edfdf1d 100644 (file)
 #include "RenderIndicator.h"
 
 #include "RenderTheme.h"
-#include "ShadowElement.h"
+#include "RenderView.h"
 
 using namespace std;
 
 namespace WebCore {
 
+RenderIndicatorPart::RenderIndicatorPart(Node* node)
+    : RenderBlock(node)
+    , m_originalVisibility(HIDDEN)
+{
+}
+
+RenderIndicatorPart::~RenderIndicatorPart()
+{
+}
+
+void RenderIndicatorPart::layout()
+{
+    RenderBox* parentRenderer = toRenderBox(parent());
+    IntRect oldRect = frameRect();
+    IntRect newRect = preferredFrameRect();
+
+    LayoutStateMaintainer statePusher(parentRenderer->view(), parentRenderer, parentRenderer->size(), parentRenderer->style()->isFlippedBlocksWritingMode());
+
+    if (oldRect.size() != newRect.size())
+        setChildNeedsLayout(true, false);
+    if (needsLayout())
+        RenderBlock::layout();
+    setFrameRect(newRect);
+
+    if (checkForRepaintDuringLayout())
+        repaintDuringLayoutIfMoved(oldRect);
+        
+    statePusher.pop();
+    parentRenderer->addOverflowFromChild(this);
+    style()->setVisibility(shouldBeHidden() ? HIDDEN : originalVisibility());
+}
+
+void RenderIndicatorPart::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
+{
+    m_originalVisibility = style()->visibility();
+    RenderBlock::styleDidChange(diff, oldStyle);
+}
+
+
 RenderIndicator::RenderIndicator(Node* node)
     : RenderBlock(node)
 {
index 50d819d4eeeef855e7492b7407613efd7b5f052a..7c2a346e66f1a2822a9e0df8c4234a32bad50c53 100644 (file)
 
 namespace WebCore {
 
+class RenderIndicatorPart : public RenderBlock {
+public:
+    RenderIndicatorPart(Node*);
+    virtual ~RenderIndicatorPart();
+
+protected:
+    EVisibility originalVisibility() const { return m_originalVisibility; }
+    virtual IntRect preferredFrameRect() = 0;
+    virtual bool shouldBeHidden() = 0;
+private:
+    virtual void layout();
+    virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
+    virtual bool canHaveChildren() const { return false; }
+    virtual void styleDidChange(StyleDifference, const RenderStyle*);
+
+    EVisibility m_originalVisibility;
+};
+
 class RenderIndicator : public RenderBlock {
 public:
     RenderIndicator(Node*);
index 1ec0a72b09f61c911aa7e7cb79e5d5b69efad0b0..2a8e6f3793f6fe59e21640c211eaf6200c4a4d74 100644 (file)
@@ -36,6 +36,16 @@ using namespace std;
 
 namespace WebCore {
 
+IntRect RenderProgressBarValuePart::preferredFrameRect()
+{
+    return toRenderProgress(parent())->valuePartRect();
+}
+
+bool RenderProgressBarValuePart::shouldBeHidden()
+{
+    return !toRenderProgress(parent())->shouldHaveParts();
+}
+
 RenderProgress::RenderProgress(HTMLProgressElement* element)
     : RenderIndicator(element)
     , m_position(-1)
@@ -53,11 +63,6 @@ RenderProgress::~RenderProgress()
 
 void RenderProgress::updateFromElement()
 {
-    if (shouldHaveParts())
-        style()->setAppearance(NoControlPart);
-    else if (valuePart()->renderer())
-        valuePart()->renderer()->style()->setVisibility(HIDDEN);
-
     HTMLProgressElement* element = progressElement();
     if (m_position == element->position())
         return;
@@ -94,7 +99,8 @@ void RenderProgress::paint(PaintInfo& paintInfo, int tx, int ty)
 
 void RenderProgress::layoutParts()
 {
-    valuePart()->layoutAsPart(valuePartRect());
+    for (RenderObject* child = firstChild(); child; child = child->nextSibling())
+        child->layout();
     updateAnimationState();
 }
 
@@ -102,8 +108,6 @@ bool RenderProgress::shouldHaveParts() const
 {
     if (!style()->hasAppearance())
         return true;
-    if (!(valuePart()->renderer() && valuePart()->renderer()->style()->hasAppearance()))
-        return true;
     return false;
 }
 
@@ -137,11 +141,6 @@ HTMLProgressElement* RenderProgress::progressElement() const
     return static_cast<HTMLProgressElement*>(node());
 }    
 
-ShadowBlockElement* RenderProgress::valuePart() const
-{
-    return progressElement()->valuePart();
-}
-
 } // namespace WebCore
 
 #endif
index d5d036c5e490ccfedcaf8ebec03e070530c8070d..78cf359141eff95cd3d46c2c18c29c5e6d9c77c2 100644 (file)
 namespace WebCore {
 
 class HTMLProgressElement;
-class ShadowBlockElement;
+
+class RenderProgressBarValuePart : public RenderIndicatorPart {
+public:
+    RenderProgressBarValuePart(Node* node) : RenderIndicatorPart(node) {}
+private:
+    virtual IntRect preferredFrameRect();
+    virtual bool shouldBeHidden();
+};
 
 class RenderProgress : public RenderIndicator {
 public:
@@ -40,6 +47,8 @@ public:
     double animationStartTime() const { return m_animationStartTime; }
 
     bool isDeterminate() const;
+    IntRect valuePartRect() const;
+    bool shouldHaveParts() const;
 
     HTMLProgressElement* progressElement() const;
 
@@ -48,17 +57,11 @@ private:
     virtual bool isProgress() const { return true; }
     virtual void updateFromElement();
     virtual void paint(PaintInfo&, int tx, int ty);
-
     virtual void layoutParts();
 
-    IntRect valuePartRect() const;
-    bool shouldHaveParts() const;
-
     void animationTimerFired(Timer<RenderProgress>*);
     void updateAnimationState();
 
-    ShadowBlockElement* valuePart() const;
-
     double m_position;
     double m_animationStartTime;
     double m_animationRepeatInterval;