[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

morrita at google.com morrita at google.com
Mon Feb 21 00:24:49 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 45c6a5f4b73b1fb1f8231ce1327bd5b2653e314f
Author: morrita at google.com <morrita at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jan 31 04:39:23 2011 +0000

    2011-01-27  MORITA Hajime  <morrita at google.com>
    
            Reviewed by Dimitri Glazkov.
    
            Convert <progress> shadow DOM to a DOM-based shadow.
            https://bugs.webkit.org/show_bug.cgi?id=50660
    
            * Removed RenderProgress::m_valuePart, moved the shadow node
              to the shadow root of HTMLProgressElement.
            * Removed hard-coded pseudo ID for -webkit-progress-bar-value.
              ProgressBarValueElement is defined only for overriding
              shadowPseudoId().
    
            No new tests. No behavioral change.
    
            * css/CSSSelector.cpp:
            (WebCore::CSSSelector::pseudoId):
            (WebCore::nameToPseudoTypeMap):
            (WebCore::CSSSelector::extractPseudoType):
            * css/CSSSelector.h:
            * html/HTMLProgressElement.cpp:
            (WebCore::ProgressBarValueElement::ProgressBarValueElement):
            (WebCore::ProgressBarValueElement::shadowPseudoId):
            (WebCore::ProgressBarValueElement::create):
            (WebCore::HTMLProgressElement::parseMappedAttribute):
            (WebCore::HTMLProgressElement::attach):
            (WebCore::HTMLProgressElement::valuePart):
            (WebCore::HTMLProgressElement::didElementStateChange):
            (WebCore::HTMLProgressElement::createShadowSubtreeIfNeeded):
            * html/HTMLProgressElement.h:
            * rendering/RenderProgress.cpp:
            (WebCore::RenderProgress::~RenderProgress):
            (WebCore::RenderProgress::updateFromElement):
            (WebCore::RenderProgress::layoutParts):
            (WebCore::RenderProgress::shouldHaveParts):
            (WebCore::RenderProgress::valuePart):
            * rendering/RenderProgress.h:
            * rendering/style/RenderStyleConstants.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77107 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index b3f5d13..79f5820 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,42 @@
+2011-01-27  MORITA Hajime  <morrita at google.com>
+
+        Reviewed by Dimitri Glazkov.
+        
+        Convert <progress> shadow DOM to a DOM-based shadow.
+        https://bugs.webkit.org/show_bug.cgi?id=50660
+
+        * Removed RenderProgress::m_valuePart, moved the shadow node
+          to the shadow root of HTMLProgressElement.
+        * Removed hard-coded pseudo ID for -webkit-progress-bar-value.
+          ProgressBarValueElement is defined only for overriding
+          shadowPseudoId().
+        
+        No new tests. No behavioral change.
+
+        * css/CSSSelector.cpp:
+        (WebCore::CSSSelector::pseudoId):
+        (WebCore::nameToPseudoTypeMap):
+        (WebCore::CSSSelector::extractPseudoType):
+        * css/CSSSelector.h:
+        * html/HTMLProgressElement.cpp:
+        (WebCore::ProgressBarValueElement::ProgressBarValueElement):
+        (WebCore::ProgressBarValueElement::shadowPseudoId):
+        (WebCore::ProgressBarValueElement::create):
+        (WebCore::HTMLProgressElement::parseMappedAttribute):
+        (WebCore::HTMLProgressElement::attach):
+        (WebCore::HTMLProgressElement::valuePart):
+        (WebCore::HTMLProgressElement::didElementStateChange):
+        (WebCore::HTMLProgressElement::createShadowSubtreeIfNeeded):
+        * html/HTMLProgressElement.h:
+        * rendering/RenderProgress.cpp:
+        (WebCore::RenderProgress::~RenderProgress):
+        (WebCore::RenderProgress::updateFromElement):
+        (WebCore::RenderProgress::layoutParts):
+        (WebCore::RenderProgress::shouldHaveParts):
+        (WebCore::RenderProgress::valuePart):
+        * rendering/RenderProgress.h:
+        * rendering/style/RenderStyleConstants.h:
+
 2011-01-30  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Ariya Hidayat.
diff --git a/Source/WebCore/css/CSSSelector.cpp b/Source/WebCore/css/CSSSelector.cpp
index 1be7f36..df192d7 100644
--- a/Source/WebCore/css/CSSSelector.cpp
+++ b/Source/WebCore/css/CSSSelector.cpp
@@ -168,14 +168,6 @@ PseudoId CSSSelector::pseudoId(PseudoType type)
         return INNER_SPIN_BUTTON;
     case PseudoOuterSpinButton:
         return OUTER_SPIN_BUTTON;
-    case PseudoProgressBarValue:
-#if ENABLE(PROGRESS_TAG)
-        return PROGRESS_BAR_VALUE;
-#else
-        ASSERT_NOT_REACHED();
-        return NOPSEUDO;
-#endif
-
 #if ENABLE(METER_TAG)
     case PseudoMeterHorizontalBar:
         return METER_HORIZONTAL_BAR;
@@ -335,10 +327,6 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap(
     DEFINE_STATIC_LOCAL(AtomicString, onlyOfType, ("only-of-type"));
     DEFINE_STATIC_LOCAL(AtomicString, optional, ("optional"));
     DEFINE_STATIC_LOCAL(AtomicString, outerSpinButton, ("-webkit-outer-spin-button"));
-#if ENABLE(PROGRESS_TAG)
-    DEFINE_STATIC_LOCAL(AtomicString, progressBarValue, ("-webkit-progress-bar-value"));
-#endif
-
 #if ENABLE(METER_TAG)
     DEFINE_STATIC_LOCAL(AtomicString, meterHorizontalBar, ("-webkit-meter-horizontal-bar"));
     DEFINE_STATIC_LOCAL(AtomicString, meterHorizontalOptimumValue, ("-webkit-meter-horizontal-optimum-value"));
@@ -442,9 +430,6 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap(
         nameToPseudoType->set(nthLastChild.impl(), CSSSelector::PseudoNthLastChild);
         nameToPseudoType->set(nthLastOfType.impl(), CSSSelector::PseudoNthLastOfType);
         nameToPseudoType->set(outerSpinButton.impl(), CSSSelector::PseudoOuterSpinButton);
-#if ENABLE(PROGRESS_TAG)
-        nameToPseudoType->set(progressBarValue.impl(), CSSSelector::PseudoProgressBarValue);
-#endif
 #if ENABLE(METER_TAG)
         nameToPseudoType->set(meterHorizontalBar.impl(), CSSSelector::PseudoMeterHorizontalBar);
         nameToPseudoType->set(meterHorizontalOptimumValue.impl(), CSSSelector::PseudoMeterHorizontalOptimum);
@@ -544,7 +529,6 @@ void CSSSelector::extractPseudoType() const
     case PseudoMeterVerticalSuboptimal:
     case PseudoMeterVerticalEvenLessGood:
     case PseudoOuterSpinButton:
-    case PseudoProgressBarValue:
     case PseudoResizer:
     case PseudoScrollbar:
     case PseudoScrollbarCorner:
diff --git a/Source/WebCore/css/CSSSelector.h b/Source/WebCore/css/CSSSelector.h
index cbe3e9b..f3f800b 100644
--- a/Source/WebCore/css/CSSSelector.h
+++ b/Source/WebCore/css/CSSSelector.h
@@ -195,7 +195,6 @@ namespace WebCore {
 #endif
             PseudoInnerSpinButton,
             PseudoOuterSpinButton,
-            PseudoProgressBarValue,
             PseudoLeftPage,
             PseudoRightPage,
             PseudoFirstPage,
diff --git a/Source/WebCore/html/HTMLProgressElement.cpp b/Source/WebCore/html/HTMLProgressElement.cpp
index 4a55a1e..1655823 100644
--- a/Source/WebCore/html/HTMLProgressElement.cpp
+++ b/Source/WebCore/html/HTMLProgressElement.cpp
@@ -30,12 +30,33 @@
 #include "HTMLNames.h"
 #include "HTMLParserIdioms.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;
+    }
+
+    static PassRefPtr<ProgressBarValueElement> create(HTMLElement* shadowParent)
+    {
+        return adoptRef(new ProgressBarValueElement(shadowParent));
+    }
+
+};
+
 HTMLProgressElement::HTMLProgressElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
     : HTMLFormControlElement(tagName, document, form)
 {
@@ -60,21 +81,19 @@ const AtomicString& HTMLProgressElement::formControlType() const
 
 void HTMLProgressElement::parseMappedAttribute(Attribute* attribute)
 {
-    if (attribute->name() == valueAttr) {
-        if (renderer())
-            renderer()->updateFromElement();
-    } else if (attribute->name() == maxAttr) {
-        if (renderer())
-            renderer()->updateFromElement();
-    } else
+    if (attribute->name() == valueAttr)
+        didElementStateChange();
+    else if (attribute->name() == maxAttr)
+        didElementStateChange();
+    else
         HTMLFormControlElement::parseMappedAttribute(attribute);
 }
 
 void HTMLProgressElement::attach()
 {
+    createShadowSubtreeIfNeeded();
     HTMLFormControlElement::attach();
-    if (renderer())
-        renderer()->updateFromElement();
+    didElementStateChange();
 }
 
 double HTMLProgressElement::value() const
@@ -121,5 +140,23 @@ double HTMLProgressElement::position() const
     return value() / max();
 }
 
+ShadowBlockElement* HTMLProgressElement::valuePart()
+{
+    return static_cast<ShadowBlockElement*>(shadowRoot());
+}
+
+void HTMLProgressElement::didElementStateChange()
+{
+    if (renderer())
+        renderer()->updateFromElement();
+}
+
+void HTMLProgressElement::createShadowSubtreeIfNeeded()
+{
+    if (shadowRoot())
+        return;
+    setShadowRoot(ProgressBarValueElement::create(this).get());
+}
+
 } // namespace
 #endif
diff --git a/Source/WebCore/html/HTMLProgressElement.h b/Source/WebCore/html/HTMLProgressElement.h
index c80f50f..3f43cd9 100644
--- a/Source/WebCore/html/HTMLProgressElement.h
+++ b/Source/WebCore/html/HTMLProgressElement.h
@@ -26,6 +26,8 @@
 
 namespace WebCore {
 
+class ShadowBlockElement;
+
 class HTMLProgressElement : public HTMLFormControlElement {
 public:
     static PassRefPtr<HTMLProgressElement> create(const QualifiedName&, Document*, HTMLFormElement*);
@@ -38,6 +40,7 @@ public:
 
     double position() const;
 
+    ShadowBlockElement* valuePart();
 private:
     HTMLProgressElement(const QualifiedName&, Document*, HTMLFormElement*);
 
@@ -50,6 +53,9 @@ private:
     virtual void parseMappedAttribute(Attribute*);
 
     virtual void attach();
+
+    void didElementStateChange();
+    void createShadowSubtreeIfNeeded();
 };
 
 } // namespace
diff --git a/Source/WebCore/rendering/RenderProgress.cpp b/Source/WebCore/rendering/RenderProgress.cpp
index 4194e2b..1ec0a72 100644
--- a/Source/WebCore/rendering/RenderProgress.cpp
+++ b/Source/WebCore/rendering/RenderProgress.cpp
@@ -49,22 +49,14 @@ RenderProgress::RenderProgress(HTMLProgressElement* element)
 
 RenderProgress::~RenderProgress()
 {
-    if (m_valuePart)
-        m_valuePart->detach();
 }
 
 void RenderProgress::updateFromElement()
 {
-    if (!m_valuePart) {
-        m_valuePart = ShadowBlockElement::createForPart(static_cast<HTMLElement*>(node()), PROGRESS_BAR_VALUE);
-        if (m_valuePart->renderer())
-            addChild(m_valuePart->renderer());
-    }
-
     if (shouldHaveParts())
         style()->setAppearance(NoControlPart);
-    else if (m_valuePart->renderer())
-        m_valuePart->renderer()->style()->setVisibility(HIDDEN);
+    else if (valuePart()->renderer())
+        valuePart()->renderer()->style()->setVisibility(HIDDEN);
 
     HTMLProgressElement* element = progressElement();
     if (m_position == element->position())
@@ -102,7 +94,7 @@ void RenderProgress::paint(PaintInfo& paintInfo, int tx, int ty)
 
 void RenderProgress::layoutParts()
 {
-    m_valuePart->layoutAsPart(valuePartRect());
+    valuePart()->layoutAsPart(valuePartRect());
     updateAnimationState();
 }
 
@@ -110,7 +102,7 @@ bool RenderProgress::shouldHaveParts() const
 {
     if (!style()->hasAppearance())
         return true;
-    if (ShadowBlockElement::partShouldHaveStyle(this, PROGRESS_BAR_VALUE))
+    if (!(valuePart()->renderer() && valuePart()->renderer()->style()->hasAppearance()))
         return true;
     return false;
 }
@@ -145,6 +137,11 @@ HTMLProgressElement* RenderProgress::progressElement() const
     return static_cast<HTMLProgressElement*>(node());
 }    
 
+ShadowBlockElement* RenderProgress::valuePart() const
+{
+    return progressElement()->valuePart();
+}
+
 } // namespace WebCore
 
 #endif
diff --git a/Source/WebCore/rendering/RenderProgress.h b/Source/WebCore/rendering/RenderProgress.h
index 9ed5741..d5d036c 100644
--- a/Source/WebCore/rendering/RenderProgress.h
+++ b/Source/WebCore/rendering/RenderProgress.h
@@ -57,13 +57,14 @@ private:
     void animationTimerFired(Timer<RenderProgress>*);
     void updateAnimationState();
 
+    ShadowBlockElement* valuePart() const;
+
     double m_position;
     double m_animationStartTime;
     double m_animationRepeatInterval;
     double m_animationDuration;
     bool m_animating;
     Timer<RenderProgress> m_animationTimer;
-    RefPtr<ShadowBlockElement> m_valuePart;
 };
 
 inline RenderProgress* toRenderProgress(RenderObject* object)
diff --git a/Source/WebCore/rendering/style/RenderStyleConstants.h b/Source/WebCore/rendering/style/RenderStyleConstants.h
index 633d482..c95bf5a 100644
--- a/Source/WebCore/rendering/style/RenderStyleConstants.h
+++ b/Source/WebCore/rendering/style/RenderStyleConstants.h
@@ -71,7 +71,7 @@ enum PseudoId {
     SEARCH_CANCEL_BUTTON, SEARCH_DECORATION, SEARCH_RESULTS_DECORATION, SEARCH_RESULTS_BUTTON, MEDIA_CONTROLS_PANEL,
     MEDIA_CONTROLS_TIMELINE_CONTAINER, MEDIA_CONTROLS_VOLUME_SLIDER_CONTAINER, MEDIA_CONTROLS_CURRENT_TIME_DISPLAY, MEDIA_CONTROLS_TIME_REMAINING_DISPLAY, 
     MEDIA_CONTROLS_STATUS_DISPLAY, SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER,
-    INPUT_LIST_BUTTON, INPUT_SPEECH_BUTTON, INNER_SPIN_BUTTON, OUTER_SPIN_BUTTON, VISITED_LINK, PROGRESS_BAR_VALUE,
+    INPUT_LIST_BUTTON, INPUT_SPEECH_BUTTON, INNER_SPIN_BUTTON, OUTER_SPIN_BUTTON, VISITED_LINK,
     METER_HORIZONTAL_BAR, METER_HORIZONTAL_OPTIMUM, METER_HORIZONTAL_SUBOPTIMAL, METER_HORIZONTAL_EVEN_LESS_GOOD,
     METER_VERTICAL_BAR, METER_VERTICAL_OPTIMUM, METER_VERTICAL_SUBOPTIMAL, METER_VERTICAL_EVEN_LESS_GOOD, 
     AFTER_LAST_INTERNAL_PSEUDOID,

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list