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

dglazkov at chromium.org dglazkov at chromium.org
Sun Feb 20 22:55:24 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 99dea9ee6d392067c8ade877d2ff5fc6d4d02c9c
Author: dglazkov at chromium.org <dglazkov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 13 19:38:11 2011 +0000

    Unreviewed, rolling out r75725.
    http://trac.webkit.org/changeset/75725
    https://bugs.webkit.org/show_bug.cgi?id=52317
    
    Caused crashes in layout tests.
    
    * css/CSSStyleSelector.cpp:
    (WebCore::CSSStyleSelector::initForStyleResolve):
    * html/HTMLInputElement.cpp:
    (WebCore::HTMLInputElement::updateType):
    * html/InputType.cpp:
    * html/InputType.h:
    * html/RangeInputType.cpp:
    * html/RangeInputType.h:
    * html/shadow/SliderThumbElement.cpp:
    (WebCore::SliderThumbElement::defaultEventHandler):
    (WebCore::SliderThumbElement::detach):
    * html/shadow/SliderThumbElement.h:
    (WebCore::SliderThumbElement::SliderThumbElement):
    (WebCore::SliderThumbElement::create):
    * rendering/MediaControlElements.cpp:
    (WebCore::MediaControlInputElement::attach):
    (WebCore::MediaControlInputElement::updateStyle):
    * rendering/RenderSlider.cpp:
    (WebCore::RenderSlider::~RenderSlider):
    (WebCore::RenderSlider::styleDidChange):
    (WebCore::RenderSlider::createThumbStyle):
    (WebCore::RenderSlider::thumbRect):
    (WebCore::RenderSlider::layout):
    (WebCore::RenderSlider::updateFromElement):
    (WebCore::RenderSlider::mouseEventIsInThumb):
    (WebCore::RenderSlider::mouseEventOffsetToThumb):
    (WebCore::RenderSlider::setValueForPosition):
    (WebCore::RenderSlider::positionForOffset):
    (WebCore::RenderSlider::currentPosition):
    (WebCore::RenderSlider::trackSize):
    (WebCore::RenderSlider::forwardEvent):
    (WebCore::RenderSlider::inDragMode):
    * rendering/RenderSlider.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75728 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 79a7235..205626f 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,45 @@
+2011-01-13  Dimitri Glazkov  <dglazkov at chromium.org>
+
+        Unreviewed, rolling out r75725.
+        http://trac.webkit.org/changeset/75725
+        https://bugs.webkit.org/show_bug.cgi?id=52317
+
+        Caused crashes in layout tests.
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::initForStyleResolve):
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::updateType):
+        * html/InputType.cpp:
+        * html/InputType.h:
+        * html/RangeInputType.cpp:
+        * html/RangeInputType.h:
+        * html/shadow/SliderThumbElement.cpp:
+        (WebCore::SliderThumbElement::defaultEventHandler):
+        (WebCore::SliderThumbElement::detach):
+        * html/shadow/SliderThumbElement.h:
+        (WebCore::SliderThumbElement::SliderThumbElement):
+        (WebCore::SliderThumbElement::create):
+        * rendering/MediaControlElements.cpp:
+        (WebCore::MediaControlInputElement::attach):
+        (WebCore::MediaControlInputElement::updateStyle):
+        * rendering/RenderSlider.cpp:
+        (WebCore::RenderSlider::~RenderSlider):
+        (WebCore::RenderSlider::styleDidChange):
+        (WebCore::RenderSlider::createThumbStyle):
+        (WebCore::RenderSlider::thumbRect):
+        (WebCore::RenderSlider::layout):
+        (WebCore::RenderSlider::updateFromElement):
+        (WebCore::RenderSlider::mouseEventIsInThumb):
+        (WebCore::RenderSlider::mouseEventOffsetToThumb):
+        (WebCore::RenderSlider::setValueForPosition):
+        (WebCore::RenderSlider::positionForOffset):
+        (WebCore::RenderSlider::currentPosition):
+        (WebCore::RenderSlider::trackSize):
+        (WebCore::RenderSlider::forwardEvent):
+        (WebCore::RenderSlider::inDragMode):
+        * rendering/RenderSlider.h:
+
 2011-01-12  Dimitri Glazkov  <dglazkov at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/Source/WebCore/css/CSSStyleSelector.cpp b/Source/WebCore/css/CSSStyleSelector.cpp
index 6363ca9..e1e6393 100644
--- a/Source/WebCore/css/CSSStyleSelector.cpp
+++ b/Source/WebCore/css/CSSStyleSelector.cpp
@@ -822,7 +822,12 @@ inline void CSSStyleSelector::initForStyleResolve(Element* e, RenderStyle* paren
 {
     m_checker.m_pseudoStyle = pseudoID;
 
-    m_parentNode = e ? e->parentOrHostNode() : 0;
+    m_parentNode = e ? e->parentNode() : 0;
+
+#if ENABLE(SVG)
+    if (!m_parentNode && e && e->isSVGElement() && e->isShadowRoot())
+        m_parentNode = e->shadowHost();
+#endif
 
     if (parentStyle)
         m_parentStyle = parentStyle;
diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp
index 7d2a3c5..007639b 100644
--- a/Source/WebCore/html/HTMLInputElement.cpp
+++ b/Source/WebCore/html/HTMLInputElement.cpp
@@ -447,9 +447,7 @@ void HTMLInputElement::updateType()
     bool neededActivationCallback = needsActivationCallback();
     bool didRespectHeightAndWidth = m_inputType->shouldRespectHeightAndWidthAttributes();
 
-    m_inputType->destroyShadowSubtree();
     m_inputType = newType.release();
-    m_inputType->createShadowSubtree();
 
     setNeedsWillValidateCheck();
 
diff --git a/Source/WebCore/html/InputType.cpp b/Source/WebCore/html/InputType.cpp
index 729f204..be86399 100644
--- a/Source/WebCore/html/InputType.cpp
+++ b/Source/WebCore/html/InputType.cpp
@@ -349,15 +349,6 @@ RenderObject* InputType::createRenderer(RenderArena*, RenderStyle* style) const
     return RenderObject::createObject(element(), style);
 }
 
-void InputType::createShadowSubtree()
-{
-}
-
-void InputType::destroyShadowSubtree()
-{
-    element()->setShadowRoot(0);
-}
-
 double InputType::parseToDouble(const String&, double defaultValue) const
 {
     return defaultValue;
diff --git a/Source/WebCore/html/InputType.h b/Source/WebCore/html/InputType.h
index 0d1f6b8..4d25a97 100644
--- a/Source/WebCore/html/InputType.h
+++ b/Source/WebCore/html/InputType.h
@@ -171,12 +171,6 @@ public:
     virtual void accessKeyAction(bool sendToAnyElement);
     virtual bool canBeSuccessfulSubmitButton();
 
-
-    // Shadow tree handling
-
-    virtual void createShadowSubtree();
-    void destroyShadowSubtree();
-
     // Miscellaneous functions
 
     virtual bool rendererIsNeeded();
diff --git a/Source/WebCore/html/RangeInputType.cpp b/Source/WebCore/html/RangeInputType.cpp
index 3fcb641..5d71da7 100644
--- a/Source/WebCore/html/RangeInputType.cpp
+++ b/Source/WebCore/html/RangeInputType.cpp
@@ -37,7 +37,6 @@
 #include "HTMLParserIdioms.h"
 #include "KeyboardEvent.h"
 #include "RenderSlider.h"
-#include "SliderThumbElement.h"
 #include "StepRange.h"
 #include <limits>
 #include <wtf/MathExtras.h>
@@ -187,11 +186,6 @@ void RangeInputType::forwardEvent(Event* event)
         toRenderSlider(element()->renderer())->forwardEvent(event);
 }
 
-void RangeInputType::createShadowSubtree()
-{
-    element()->setShadowRoot(SliderThumbElement::create(element()->document()));
-}
-
 RenderObject* RangeInputType::createRenderer(RenderArena* arena, RenderStyle*) const
 {
     return new (arena) RenderSlider(element());
diff --git a/Source/WebCore/html/RangeInputType.h b/Source/WebCore/html/RangeInputType.h
index 57eb299..7f341a7 100644
--- a/Source/WebCore/html/RangeInputType.h
+++ b/Source/WebCore/html/RangeInputType.h
@@ -58,7 +58,6 @@ private:
     virtual void handleKeydownEvent(KeyboardEvent*);
     virtual void forwardEvent(Event*);
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) const;
-    virtual void createShadowSubtree();
     virtual double parseToDouble(const String&, double) const;
     virtual String serialize(double) const;
     virtual void accessKeyAction(bool sendToAnyElement);
diff --git a/Source/WebCore/html/shadow/SliderThumbElement.cpp b/Source/WebCore/html/shadow/SliderThumbElement.cpp
index 79a009b..55301c1 100644
--- a/Source/WebCore/html/shadow/SliderThumbElement.cpp
+++ b/Source/WebCore/html/shadow/SliderThumbElement.cpp
@@ -37,53 +37,13 @@
 #include "Frame.h"
 #include "MouseEvent.h"
 #include "RenderSlider.h"
-#include "RenderTheme.h"
 
 namespace WebCore {
 
-// FIXME: Find a way to cascade appearance (see the layout method) and get rid of this class.
-class RenderSliderThumb : public RenderBlock {
-public:
-    RenderSliderThumb(Node*);
-    virtual void layout();
-};
-
-
-RenderSliderThumb::RenderSliderThumb(Node* node)
-    : RenderBlock(node)
-{
-}
-
-void RenderSliderThumb::layout()
-{
-    // FIXME: Hard-coding this cascade of appearance is bad, because it's something
-    // that CSS usually does. We need to find a way to express this in CSS.
-    RenderStyle* parentStyle = parent()->style();
-    if (parentStyle->appearance() == SliderVerticalPart)
-        style()->setAppearance(SliderThumbVerticalPart);
-    else if (parentStyle->appearance() == SliderHorizontalPart)
-        style()->setAppearance(SliderThumbHorizontalPart);
-    else if (parentStyle->appearance() == MediaSliderPart)
-        style()->setAppearance(MediaSliderThumbPart);
-    else if (parentStyle->appearance() == MediaVolumeSliderPart)
-        style()->setAppearance(MediaVolumeSliderThumbPart);
-
-    if (style()->hasAppearance()) {
-        // FIXME: This should pass the style, not the renderer, to the theme.
-        theme()->adjustSliderThumbSize(this);
-    }
-    RenderBlock::layout();
-}
-
-RenderObject* SliderThumbElement::createRenderer(RenderArena* arena, RenderStyle*)
-{
-    return new (arena) RenderSliderThumb(this);
-}
-
 void SliderThumbElement::defaultEventHandler(Event* event)
 {
     if (!event->isMouseEvent()) {
-        HTMLDivElement::defaultEventHandler(event);
+        ShadowBlockElement::defaultEventHandler(event);
         return;
     }
 
@@ -133,7 +93,7 @@ void SliderThumbElement::defaultEventHandler(Event* event)
         }
     }
 
-    HTMLDivElement::defaultEventHandler(event);
+    ShadowBlockElement::defaultEventHandler(event);
 }
 
 void SliderThumbElement::detach()
@@ -142,7 +102,7 @@ void SliderThumbElement::detach()
         if (Frame* frame = document()->frame())
             frame->eventHandler()->setCapturingMouseEventsNode(0);      
     }
-    HTMLDivElement::detach();
+    ShadowBlockElement::detach();
 }
 
 }
diff --git a/Source/WebCore/html/shadow/SliderThumbElement.h b/Source/WebCore/html/shadow/SliderThumbElement.h
index 7219186..5220f2b 100644
--- a/Source/WebCore/html/shadow/SliderThumbElement.h
+++ b/Source/WebCore/html/shadow/SliderThumbElement.h
@@ -33,9 +33,8 @@
 #define SliderThumbElement_h
 
 #include "FloatPoint.h"
-#include "HTMLDivElement.h"
-#include "HTMLNames.h"
 #include "RenderStyleConstants.h"
+#include "ShadowElement.h"
 #include <wtf/Forward.h>
 
 namespace WebCore {
@@ -44,9 +43,9 @@ class HTMLElement;
 class Event;
 class FloatPoint;
 
-class SliderThumbElement : public HTMLDivElement {
+class SliderThumbElement : public ShadowBlockElement {
 public:
-    static PassRefPtr<SliderThumbElement> create(Document*);
+    static PassRefPtr<SliderThumbElement> create(HTMLElement* shadowParent);
 
     bool inDragMode() const { return m_inDragMode; }
 
@@ -54,23 +53,22 @@ public:
     virtual void detach();
     virtual AtomicString shadowPseudoId() const;
 
-private:
-    SliderThumbElement(Document*);
-    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+private:        
+    SliderThumbElement(HTMLElement* shadowParent);
 
     FloatPoint m_offsetToThumb;
     bool m_inDragMode;
 };
 
-inline SliderThumbElement::SliderThumbElement(Document* document)
-    : HTMLDivElement(HTMLNames::divTag, document)
+inline SliderThumbElement::SliderThumbElement(HTMLElement* shadowParent)
+    : ShadowBlockElement(shadowParent)
     , m_inDragMode(false)
 {
 }
 
-inline PassRefPtr<SliderThumbElement> SliderThumbElement::create(Document* document)
+inline PassRefPtr<SliderThumbElement> SliderThumbElement::create(HTMLElement* shadowParent)
 {
-    return adoptRef(new SliderThumbElement(document));
+    return adoptRef(new SliderThumbElement(shadowParent));
 }
 
 inline AtomicString SliderThumbElement::shadowPseudoId() const
@@ -79,12 +77,7 @@ inline AtomicString SliderThumbElement::shadowPseudoId() const
     return sliderThumb;
 }
 
-inline SliderThumbElement* toSliderThumbElement(Node* node)
-{
-    ASSERT(!node || node->isHTMLElement());
-    return static_cast<SliderThumbElement*>(node);
 }
 
-}
 
 #endif
diff --git a/Source/WebCore/rendering/MediaControlElements.cpp b/Source/WebCore/rendering/MediaControlElements.cpp
index e27181e..e5e5ae5 100644
--- a/Source/WebCore/rendering/MediaControlElements.cpp
+++ b/Source/WebCore/rendering/MediaControlElements.cpp
@@ -449,12 +449,6 @@ void MediaControlInputElement::attach()
         parentNode()->renderer()->addChild(renderer, sibling ? sibling->renderer() : 0);
     }  
     ContainerNode::attach();
-    // FIXME: Currently, MeidaControlInput circumvents the normal attachment
-    // and style recalc cycle and thus we need to add extra logic to be aware of
-    // the shadow DOM. Remove this once all media controls are transitioned to use the regular
-    // style calculation.
-    if (Node* shadowNode = shadowRoot())
-        shadowNode->attach();
 }
 
 void MediaControlInputElement::updateStyle()
@@ -473,13 +467,6 @@ void MediaControlInputElement::updateStyle()
         attach();
     else if (renderer())
         renderer()->setStyle(style.get());
-
-    // FIXME: Currently, MeidaControlInput circumvents the normal attachment
-    // and style recalc cycle and thus we need to add extra logic to be aware of
-    // the shadow DOM. Remove this once all media controls are transitioned to use
-    // the new shadow DOM.
-    if (Node* shadowNode = shadowRoot())
-        shadowNode->recalcStyle(Node::Force);
 }
     
 bool MediaControlInputElement::hitTest(const IntPoint& absPoint)
diff --git a/Source/WebCore/rendering/RenderSlider.cpp b/Source/WebCore/rendering/RenderSlider.cpp
index b0dc0d9..5eff826 100644
--- a/Source/WebCore/rendering/RenderSlider.cpp
+++ b/Source/WebCore/rendering/RenderSlider.cpp
@@ -61,6 +61,8 @@ RenderSlider::RenderSlider(HTMLInputElement* element)
 
 RenderSlider::~RenderSlider()
 {
+    if (m_thumb)
+        m_thumb->detach();
 }
 
 int RenderSlider::baselinePosition(FontBaseline, bool /*firstLine*/, LineDirectionMode, LinePositionMode) const
@@ -99,14 +101,37 @@ void RenderSlider::computePreferredLogicalWidths()
     setPreferredLogicalWidthsDirty(false); 
 }
 
+void RenderSlider::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
+{
+    RenderBlock::styleDidChange(diff, oldStyle);
+
+    if (m_thumb)
+        m_thumb->renderer()->setStyle(createThumbStyle(style()));
+}
+
+PassRefPtr<RenderStyle> RenderSlider::createThumbStyle(const RenderStyle* parentStyle)
+{
+    RefPtr<RenderStyle> thumbStyle = document()->styleSelector()->styleForElement(m_thumb.get(), style(), false);
+
+    if (parentStyle->appearance() == SliderVerticalPart)
+        thumbStyle->setAppearance(SliderThumbVerticalPart);
+    else if (parentStyle->appearance() == SliderHorizontalPart)
+        thumbStyle->setAppearance(SliderThumbHorizontalPart);
+    else if (parentStyle->appearance() == MediaSliderPart)
+        thumbStyle->setAppearance(MediaSliderThumbPart);
+    else if (parentStyle->appearance() == MediaVolumeSliderPart)
+        thumbStyle->setAppearance(MediaVolumeSliderThumbPart);
+
+    return thumbStyle.release();
+}
+
 IntRect RenderSlider::thumbRect()
 {
-    SliderThumbElement* thumbElement = sliderThumbElement();
-    if (!thumbElement)
+    if (!m_thumb)
         return IntRect();
 
     IntRect thumbRect;
-    RenderBox* thumb = toRenderBox(thumbElement->renderer());
+    RenderBox* thumb = toRenderBox(m_thumb->renderer());
 
     thumbRect.setWidth(thumb->style()->width().calcMinValue(contentWidth()));
     thumbRect.setHeight(thumb->style()->height().calcMinValue(contentHeight()));
@@ -128,8 +153,7 @@ void RenderSlider::layout()
 {
     ASSERT(needsLayout());
 
-    SliderThumbElement* thumbElement = sliderThumbElement();
-    RenderBox* thumb = thumbElement ? toRenderBox(thumbElement->renderer()) : 0;
+    RenderBox* thumb = m_thumb ? toRenderBox(m_thumb->renderer()) : 0;
 
     IntSize baseSize(borderAndPaddingWidth(), borderAndPaddingHeight());
 
@@ -176,35 +200,43 @@ void RenderSlider::layout()
     setNeedsLayout(false);
 }
 
-SliderThumbElement* RenderSlider::sliderThumbElement() const
+void RenderSlider::updateFromElement()
 {
-    return toSliderThumbElement(static_cast<Element*>(node())->shadowRoot());
+    // Layout will take care of the thumb's size and position.
+    if (!m_thumb) {
+        m_thumb = SliderThumbElement::create(static_cast<HTMLElement*>(node()));
+        RefPtr<RenderStyle> thumbStyle = createThumbStyle(style());
+        m_thumb->setRenderer(m_thumb->createRenderer(renderArena(), thumbStyle.get()));
+        m_thumb->renderer()->setStyle(thumbStyle.release());
+        m_thumb->setAttached();
+        m_thumb->setInDocument();
+        addChild(m_thumb->renderer());
+    }
+    setNeedsLayout(true);
 }
 
 bool RenderSlider::mouseEventIsInThumb(MouseEvent* evt)
 {
-    SliderThumbElement* thumbElement = sliderThumbElement();
-    if (!thumbElement || !thumbElement->renderer())
+    if (!m_thumb || !m_thumb->renderer())
         return false;
 
 #if ENABLE(VIDEO)
     if (style()->appearance() == MediaSliderPart || style()->appearance() == MediaVolumeSliderPart) {
-        MediaControlInputElement* sliderThumb = static_cast<MediaControlInputElement*>(thumbElement->renderer()->node());
+        MediaControlInputElement *sliderThumb = static_cast<MediaControlInputElement*>(m_thumb->renderer()->node());
         return sliderThumb->hitTest(evt->absoluteLocation());
     }
 #endif
 
-    FloatPoint localPoint = thumbElement->renderBox()->absoluteToLocal(evt->absoluteLocation(), false, true);
-    IntRect thumbBounds = thumbElement->renderBox()->borderBoxRect();
+    FloatPoint localPoint = m_thumb->renderBox()->absoluteToLocal(evt->absoluteLocation(), false, true);
+    IntRect thumbBounds = m_thumb->renderBox()->borderBoxRect();
     return thumbBounds.contains(roundedIntPoint(localPoint));
 }
 
 FloatPoint RenderSlider::mouseEventOffsetToThumb(MouseEvent* evt)
 {
-    SliderThumbElement* thumbElement = sliderThumbElement();
-    ASSERT(thumbElement && thumbElement->renderer());
-    FloatPoint localPoint = thumbElement->renderBox()->absoluteToLocal(evt->absoluteLocation(), false, true);
-    IntRect thumbBounds = thumbElement->renderBox()->borderBoxRect();
+    ASSERT(m_thumb && m_thumb->renderer());
+    FloatPoint localPoint = m_thumb->renderBox()->absoluteToLocal(evt->absoluteLocation(), false, true);
+    IntRect thumbBounds = m_thumb->renderBox()->borderBoxRect();
     FloatPoint offset;
     offset.setX(thumbBounds.x() + thumbBounds.width() / 2 - localPoint.x());
     offset.setY(thumbBounds.y() + thumbBounds.height() / 2 - localPoint.y());
@@ -213,8 +245,7 @@ FloatPoint RenderSlider::mouseEventOffsetToThumb(MouseEvent* evt)
 
 void RenderSlider::setValueForPosition(int position)
 {
-    SliderThumbElement* thumbElement = sliderThumbElement();
-    if (!thumbElement || !thumbElement->renderer())
+    if (!m_thumb || !m_thumb->renderer())
         return;
 
     HTMLInputElement* element = static_cast<HTMLInputElement*>(node());
@@ -239,45 +270,40 @@ void RenderSlider::setValueForPosition(int position)
 
 int RenderSlider::positionForOffset(const IntPoint& p)
 {
-    SliderThumbElement* thumbElement = sliderThumbElement();
-    if (!thumbElement || !thumbElement->renderer())
+    if (!m_thumb || !m_thumb->renderer())
         return 0;
 
     int position;
     if (style()->appearance() == SliderVerticalPart || style()->appearance() == MediaVolumeSliderPart)
-        position = p.y() - thumbElement->renderBox()->height() / 2;
+        position = p.y() - m_thumb->renderBox()->height() / 2;
     else
-        position = p.x() - thumbElement->renderBox()->width() / 2;
+        position = p.x() - m_thumb->renderBox()->width() / 2;
     
     return max(0, min(position, trackSize()));
 }
 
 int RenderSlider::currentPosition()
 {
-    SliderThumbElement* thumbElement = sliderThumbElement();
-    ASSERT(thumbElement && thumbElement->renderer());
+    ASSERT(m_thumb);
+    ASSERT(m_thumb->renderer());
 
     if (style()->appearance() == SliderVerticalPart || style()->appearance() == MediaVolumeSliderPart)
-        return toRenderBox(thumbElement->renderer())->y() - contentBoxRect().y();
-    return toRenderBox(thumbElement->renderer())->x() - contentBoxRect().x();
+        return toRenderBox(m_thumb->renderer())->y() - contentBoxRect().y();
+    return toRenderBox(m_thumb->renderer())->x() - contentBoxRect().x();
 }
 
 int RenderSlider::trackSize()
 {
-    SliderThumbElement* thumbElement = sliderThumbElement();
-    ASSERT(thumbElement && thumbElement->renderer());
+    ASSERT(m_thumb);
+    ASSERT(m_thumb->renderer());
 
     if (style()->appearance() == SliderVerticalPart || style()->appearance() == MediaVolumeSliderPart)
-        return contentHeight() - thumbElement->renderBox()->height();
-    return contentWidth() - thumbElement->renderBox()->width();
+        return contentHeight() - m_thumb->renderBox()->height();
+    return contentWidth() - m_thumb->renderBox()->width();
 }
 
 void RenderSlider::forwardEvent(Event* event)
 {
-    SliderThumbElement* thumbElement = sliderThumbElement();
-    if (!thumbElement)
-        return;
-
     if (event->isMouseEvent()) {
         MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
         if (event->type() == eventNames().mousedownEvent && mouseEvent->button() == LeftButton) {
@@ -288,13 +314,12 @@ void RenderSlider::forwardEvent(Event* event)
         }
     }
 
-    thumbElement->defaultEventHandler(event);
+    m_thumb->defaultEventHandler(event);
 }
 
 bool RenderSlider::inDragMode() const
 {
-    SliderThumbElement* thumbElement = sliderThumbElement();
-    return thumbElement && thumbElement->inDragMode();
+    return m_thumb && m_thumb->inDragMode();
 }
 
 } // namespace WebCore
diff --git a/Source/WebCore/rendering/RenderSlider.h b/Source/WebCore/rendering/RenderSlider.h
index 5fb5921..03779a3 100644
--- a/Source/WebCore/rendering/RenderSlider.h
+++ b/Source/WebCore/rendering/RenderSlider.h
@@ -45,10 +45,8 @@ namespace WebCore {
         virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
         virtual void computePreferredLogicalWidths();
         virtual void layout();
+        virtual void updateFromElement();
 
-        // FIXME: Eventually, the logic of manipulating slider thumb should move to
-        // SliderThumbElement and accessing sliderThumbElement should not be necessary in this class.
-        SliderThumbElement* sliderThumbElement() const;
         bool mouseEventIsInThumb(MouseEvent*);
         FloatPoint mouseEventOffsetToThumb(MouseEvent*);
 
@@ -58,10 +56,16 @@ namespace WebCore {
 
         int currentPosition();
 
+        virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
+
         virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
 
+        PassRefPtr<RenderStyle> createThumbStyle(const RenderStyle* parentStyle);
+
         int trackSize();
 
+        RefPtr<SliderThumbElement> m_thumb;
+
         friend class SliderThumbElement;
     };
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list