2011-01-30 Sheriff Bot <webkit.review.bot@gmail.com>

        Unreviewed, rolling out r77107.
        http://trac.webkit.org/changeset/77107
        https://bugs.webkit.org/show_bug.cgi?id=53412

        Caused 5 new form-related test crashes (Requested by smfr on
        #webkit).

        * css/CSSSelector.cpp:
        (WebCore::CSSSelector::pseudoId):
        (WebCore::nameToPseudoTypeMap):
        (WebCore::CSSSelector::extractPseudoType):
        * css/CSSSelector.h:
        * html/HTMLProgressElement.cpp:
        (WebCore::HTMLProgressElement::parseMappedAttribute):
        (WebCore::HTMLProgressElement::attach):
        * html/HTMLProgressElement.h:
        * rendering/RenderProgress.cpp:
        (WebCore::RenderProgress::~RenderProgress):
        (WebCore::RenderProgress::updateFromElement):
        (WebCore::RenderProgress::layoutParts):
        (WebCore::RenderProgress::shouldHaveParts):
        * rendering/RenderProgress.h:
        * rendering/style/RenderStyleConstants.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77112 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9131cbe1
2011-01-30 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r77107.
http://trac.webkit.org/changeset/77107
https://bugs.webkit.org/show_bug.cgi?id=53412
Caused 5 new form-related test crashes (Requested by smfr on
#webkit).
* css/CSSSelector.cpp:
(WebCore::CSSSelector::pseudoId):
(WebCore::nameToPseudoTypeMap):
(WebCore::CSSSelector::extractPseudoType):
* css/CSSSelector.h:
* html/HTMLProgressElement.cpp:
(WebCore::HTMLProgressElement::parseMappedAttribute):
(WebCore::HTMLProgressElement::attach):
* html/HTMLProgressElement.h:
* rendering/RenderProgress.cpp:
(WebCore::RenderProgress::~RenderProgress):
(WebCore::RenderProgress::updateFromElement):
(WebCore::RenderProgress::layoutParts):
(WebCore::RenderProgress::shouldHaveParts):
* rendering/RenderProgress.h:
* rendering/style/RenderStyleConstants.h:
2011-01-30 Simon Fraser <simon.fraser@apple.com>
Reviewed by Sam Weinig.
......@@ -168,6 +168,14 @@ 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;
......@@ -327,6 +335,10 @@ 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"));
......@@ -430,6 +442,9 @@ 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);
......@@ -529,6 +544,7 @@ void CSSSelector::extractPseudoType() const
case PseudoMeterVerticalSuboptimal:
case PseudoMeterVerticalEvenLessGood:
case PseudoOuterSpinButton:
case PseudoProgressBarValue:
case PseudoResizer:
case PseudoScrollbar:
case PseudoScrollbarCorner:
......
......@@ -195,6 +195,7 @@ namespace WebCore {
#endif
PseudoInnerSpinButton,
PseudoOuterSpinButton,
PseudoProgressBarValue,
PseudoLeftPage,
PseudoRightPage,
PseudoFirstPage,
......
......@@ -30,33 +30,12 @@
#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)
{
......@@ -81,19 +60,21 @@ const AtomicString& HTMLProgressElement::formControlType() const
void HTMLProgressElement::parseMappedAttribute(Attribute* attribute)
{
if (attribute->name() == valueAttr)
didElementStateChange();
else if (attribute->name() == maxAttr)
didElementStateChange();
else
if (attribute->name() == valueAttr) {
if (renderer())
renderer()->updateFromElement();
} else if (attribute->name() == maxAttr) {
if (renderer())
renderer()->updateFromElement();
} else
HTMLFormControlElement::parseMappedAttribute(attribute);
}
void HTMLProgressElement::attach()
{
createShadowSubtreeIfNeeded();
HTMLFormControlElement::attach();
didElementStateChange();
if (renderer())
renderer()->updateFromElement();
}
double HTMLProgressElement::value() const
......@@ -140,23 +121,5 @@ 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
......@@ -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*);
......@@ -53,9 +50,6 @@ private:
virtual void parseMappedAttribute(Attribute*);
virtual void attach();
void didElementStateChange();
void createShadowSubtreeIfNeeded();
};
} // namespace
......
......@@ -49,14 +49,22 @@ 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 (valuePart()->renderer())
valuePart()->renderer()->style()->setVisibility(HIDDEN);
else if (m_valuePart->renderer())
m_valuePart->renderer()->style()->setVisibility(HIDDEN);
HTMLProgressElement* element = progressElement();
if (m_position == element->position())
......@@ -94,7 +102,7 @@ void RenderProgress::paint(PaintInfo& paintInfo, int tx, int ty)
void RenderProgress::layoutParts()
{
valuePart()->layoutAsPart(valuePartRect());
m_valuePart->layoutAsPart(valuePartRect());
updateAnimationState();
}
......@@ -102,7 +110,7 @@ bool RenderProgress::shouldHaveParts() const
{
if (!style()->hasAppearance())
return true;
if (!(valuePart()->renderer() && valuePart()->renderer()->style()->hasAppearance()))
if (ShadowBlockElement::partShouldHaveStyle(this, PROGRESS_BAR_VALUE))
return true;
return false;
}
......@@ -137,11 +145,6 @@ HTMLProgressElement* RenderProgress::progressElement() const
return static_cast<HTMLProgressElement*>(node());
}
ShadowBlockElement* RenderProgress::valuePart() const
{
return progressElement()->valuePart();
}
} // namespace WebCore
#endif
......@@ -57,14 +57,13 @@ 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)
......
......@@ -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,
INPUT_LIST_BUTTON, INPUT_SPEECH_BUTTON, INNER_SPIN_BUTTON, OUTER_SPIN_BUTTON, VISITED_LINK, PROGRESS_BAR_VALUE,
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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment