Changeset 58228 in webkit
- Timestamp:
- Apr 25, 2010 6:52:18 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r58224 r58228 1 2010-04-25 yael aharon <yael.aharon@nokia.com> 2 3 Reviewed by Adele Peterson. 4 5 Allow styling of HTMLProgressElement. 6 https://bugs.webkit.org/show_bug.cgi?id=37901 7 8 Added a test for changing the -webkit-appearance statically and dynamically. 9 10 * fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element.html: Added. 11 * platform/chromium/test_expectations.txt: 12 * platform/gtk/Skipped: 13 * platform/mac/fast/dom/HTMLProgressElement: Added. 14 * platform/mac/fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element-expected.checksum: Added. 15 * platform/mac/fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element-expected.png: Added. 16 * platform/mac/fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element-expected.txt: Added. 17 * platform/qt/Skipped: 18 * platform/win/Skipped: 19 1 20 2010-04-24 Darin Adler <darin@apple.com> 2 21 -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r58159 r58228 2633 2633 BUG38227 DEFER : fast/dom/HTMLProgressElement/progress-element.html = MISSING 2634 2634 BUG38227 DEFER : fast/dom/HTMLProgressElement/set-progress-properties.html = TEXT 2635 BUG38227 SKIP : fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element.html = FAIL 2635 2636 2636 2637 // WebKit roll 56004 -> 56026 -
trunk/LayoutTests/platform/gtk/Skipped
r58150 r58228 5834 5834 fast/dom/HTMLProgressElement/progress-element.html 5835 5835 fast/dom/HTMLProgressElement/set-progress-properties.html 5836 fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element.html 5836 5837 5837 5838 # Needs mock support, and build slave Geolocation service -
trunk/LayoutTests/platform/qt/Skipped
r58218 r58228 5220 5220 svg/custom/recursive-clippath.svg 5221 5221 svg/custom/marker-overflow-clip.svg 5222 5223 # Need new results 5224 fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element.html 5225 -
trunk/LayoutTests/platform/win/Skipped
r58217 r58228 831 831 fast/dom/HTMLProgressElement/progress-element.html 832 832 fast/dom/HTMLProgressElement/set-progress-properties.html 833 fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element.html 833 834 834 835 # No Widgets 1.0 support -
trunk/WebCore/ChangeLog
r58222 r58228 1 2010-04-25 yael aharon <yael.aharon@nokia.com> 2 3 Reviewed by Adele Peterson. 4 5 Allow styling of HTMLProgressElement. 6 https://bugs.webkit.org/show_bug.cgi?id=37901 7 8 Added a new pseudo element to represent the value portion of the progress element. 9 Web developers can style this pseudo element separate from the rest of the progress element. 10 11 Test: fast/dom/HTMLProgressElement/progress-bar-value-pseudo-element.html 12 13 * css/CSSPrimitiveValueMappings.h: 14 (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): 15 * css/CSSSelector.cpp: 16 (WebCore::CSSSelector::pseudoId): 17 (WebCore::nameToPseudoTypeMap): 18 (WebCore::CSSSelector::extractPseudoType): 19 * css/CSSSelector.h: 20 * css/CSSValueKeywords.in: 21 * platform/ThemeTypes.h: 22 * rendering/RenderProgress.cpp: 23 (WebCore::ProgressValueElement::isShadowNode): 24 (WebCore::ProgressValueElement::shadowParentNode): 25 (WebCore::ProgressValueElement::ProgressValueElement): 26 (WebCore::RenderProgress::RenderProgress): 27 (WebCore::RenderProgress::~RenderProgress): 28 (WebCore::RenderProgress::layout): 29 (WebCore::RenderProgress::styleDidChange): 30 (WebCore::RenderProgress::updateFromElement): 31 (WebCore::RenderProgress::updateValuePartState): 32 (WebCore::RenderProgress::createStyleForValuePart): 33 (WebCore::RenderProgress::updateAnimationState): 34 * rendering/RenderTheme.cpp: 35 (WebCore::RenderTheme::isControlStyled): 36 * rendering/RenderProgress.h: 37 * rendering/style/RenderStyleConstants.h: 38 1 39 2010-04-24 Simon Fraser <simon.fraser@apple.com> 2 40 -
trunk/WebCore/css/CSSPrimitiveValueMappings.h
r55980 r58228 277 277 break; 278 278 case ProgressBarPart: 279 #if ENABLE(PROGRESS_ BAR)279 #if ENABLE(PROGRESS_TAG) 280 280 m_value.ident = CSSValueProgressBar; 281 #endif 282 break; 283 case ProgressBarValuePart: 284 #if ENABLE(PROGRESS_TAG) 285 m_value.ident = CSSValueProgressBarValue; 281 286 #endif 282 287 break; -
trunk/WebCore/css/CSSSelector.cpp
r57810 r58228 144 144 case PseudoOuterSpinButton: 145 145 return OUTER_SPIN_BUTTON; 146 case PseudoProgressBarValue: 147 #if ENABLE(PROGRESS_TAG) 148 return PROGRESS_BAR_VALUE; 149 #else 150 ASSERT_NOT_REACHED(); 151 return NOPSEUDO; 152 #endif 146 153 case PseudoInputListButton: 147 154 #if ENABLE(DATALIST) … … 268 275 DEFINE_STATIC_LOCAL(AtomicString, optional, ("optional")); 269 276 DEFINE_STATIC_LOCAL(AtomicString, outerSpinButton, ("-webkit-outer-spin-button")); 270 #if ENABLE(PROGRESS_ BAR)271 DEFINE_STATIC_LOCAL(AtomicString, progressBar , ("-webkit-progress-bar"));277 #if ENABLE(PROGRESS_TAG) 278 DEFINE_STATIC_LOCAL(AtomicString, progressBarValue, ("-webkit-progress-bar-value")); 272 279 #endif 273 280 DEFINE_STATIC_LOCAL(AtomicString, required, ("required")); … … 361 368 nameToPseudoType->set(nthLastOfType.impl(), CSSSelector::PseudoNthLastOfType); 362 369 nameToPseudoType->set(outerSpinButton.impl(), CSSSelector::PseudoOuterSpinButton); 370 #if ENABLE(PROGRESS_TAG) 371 nameToPseudoType->set(progressBarValue.impl(), CSSSelector::PseudoProgressBarValue); 372 #endif 363 373 nameToPseudoType->set(root.impl(), CSSSelector::PseudoRoot); 364 374 nameToPseudoType->set(windowInactive.impl(), CSSSelector::PseudoWindowInactive); … … 440 450 case PseudoMediaControlsVolumeSliderContainer: 441 451 case PseudoOuterSpinButton: 452 case PseudoProgressBarValue: 442 453 case PseudoResizer: 443 454 case PseudoScrollbar: -
trunk/WebCore/css/CSSSelector.h
r57809 r58228 188 188 PseudoInnerSpinButton, 189 189 PseudoOuterSpinButton, 190 PseudoProgressBarValue, 190 191 }; 191 192 -
trunk/WebCore/css/CSSValueKeywords.in
r57319 r58228 584 584 outer-spin-button 585 585 progress-bar 586 progress-bar-value 586 587 slider-horizontal 587 588 slider-vertical -
trunk/WebCore/platform/ThemeTypes.h
r55980 r58228 53 53 MediaSliderPart, MediaSliderThumbPart, MediaVolumeSliderContainerPart, MediaVolumeSliderPart, MediaVolumeSliderThumbPart, 54 54 MediaControlsBackgroundPart, MediaCurrentTimePart, MediaTimeRemainingPart, 55 MenulistPart, MenulistButtonPart, MenulistTextPart, MenulistTextFieldPart, OuterSpinButtonPart, ProgressBarPart, 55 MenulistPart, MenulistButtonPart, MenulistTextPart, MenulistTextFieldPart, OuterSpinButtonPart, ProgressBarPart, ProgressBarValuePart, 56 56 SliderHorizontalPart, SliderVerticalPart, SliderThumbHorizontalPart, 57 57 SliderThumbVerticalPart, CaretPart, SearchFieldPart, SearchFieldDecorationPart, -
trunk/WebCore/rendering/RenderProgress.cpp
r57494 r58228 24 24 #include "RenderProgress.h" 25 25 26 #include "HTMLDivElement.h" 26 27 #include "HTMLProgressElement.h" 27 28 #include "RenderTheme.h" 29 #include "RenderView.h" 28 30 #include <wtf/CurrentTime.h> 31 #include <wtf/RefPtr.h> 29 32 30 33 using namespace std; … … 33 36 34 37 using namespace HTMLNames; 38 39 class ProgressValueElement : public HTMLDivElement { 40 public: 41 ProgressValueElement(Document*, Node* shadowParent); 42 43 private: 44 virtual bool isShadowNode() const { return true; } 45 virtual Node* shadowParentNode() { return m_shadowParent; } 46 47 Node* m_shadowParent; 48 }; 49 50 ProgressValueElement::ProgressValueElement(Document* document, Node* shadowParent) 51 : HTMLDivElement(divTag, document) 52 , m_shadowParent(shadowParent) 53 { 54 } 35 55 36 56 RenderProgress::RenderProgress(HTMLProgressElement* element) … … 42 62 , m_animating(false) 43 63 , m_animationTimer(this, &RenderProgress::animationTimerFired) 44 { 64 , m_valuePart(0) 65 { 66 } 67 68 RenderProgress::~RenderProgress() 69 { 70 if (m_valuePart) 71 m_valuePart->detach(); 45 72 } 46 73 … … 50 77 51 78 LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); 79 80 IntSize oldSize = size(); 52 81 53 82 calcWidth(); 54 83 calcHeight(); 55 56 m_overflow.clear(); 84 if (m_valuePart) { 85 IntRect valuePartRect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), lround((width() - borderLeft() - paddingLeft() - borderRight() - paddingRight()) * position()), height() - borderTop() - paddingTop() - borderBottom() - paddingBottom()); 86 if (style()->direction() == RTL) 87 valuePartRect.setX(width() - borderRight() - paddingRight() - valuePartRect.width()); 88 toRenderBox(m_valuePart->renderer())->setFrameRect(valuePartRect); 89 90 if (oldSize != size()) 91 m_valuePart->renderer()->setChildNeedsLayout(true, false); 92 93 LayoutStateMaintainer statePusher(view(), this, size()); 94 95 IntRect oldRect = toRenderBox(m_valuePart->renderer())->frameRect(); 96 97 m_valuePart->renderer()->layoutIfNeeded(); 98 99 toRenderBox(m_valuePart->renderer())->setFrameRect(valuePartRect); 100 if (m_valuePart->renderer()->checkForRepaintDuringLayout()) 101 m_valuePart->renderer()->repaintDuringLayoutIfMoved(oldRect); 102 103 statePusher.pop(); 104 addOverflowFromChild(toRenderBox(m_valuePart->renderer())); 105 } 57 106 58 107 updateAnimationState(); … … 63 112 } 64 113 114 void RenderProgress::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) 115 { 116 RenderBlock::styleDidChange(diff, oldStyle); 117 118 updateValuePartState(); 119 } 120 65 121 void RenderProgress::updateFromElement() 66 122 { … … 72 128 updateAnimationState(); 73 129 130 updateValuePartState(); 131 74 132 repaint(); 133 } 134 135 void RenderProgress::updateValuePartState() 136 { 137 bool needLayout = !style()->hasAppearance() || m_valuePart; 138 if (!style()->hasAppearance() && !m_valuePart) { 139 m_valuePart = new ProgressValueElement(document(), node()); 140 RefPtr<RenderStyle> styleForValuePart = createStyleForValuePart(style()); 141 m_valuePart->setRenderer(m_valuePart->createRenderer(renderArena(), styleForValuePart.get())); 142 m_valuePart->renderer()->setStyle(styleForValuePart.release()); 143 m_valuePart->setAttached(); 144 m_valuePart->setInDocument(true); 145 addChild(m_valuePart->renderer()); 146 } else if (style()->hasAppearance() && m_valuePart) { 147 m_valuePart->detach(); 148 m_valuePart = 0; 149 } 150 if (needLayout) 151 setNeedsLayout(true); 152 } 153 154 PassRefPtr<RenderStyle> RenderProgress::createStyleForValuePart(RenderStyle* parentStyle) 155 { 156 RefPtr<RenderStyle> styleForValuePart; 157 RenderStyle* pseudoStyle = getCachedPseudoStyle(PROGRESS_BAR_VALUE); 158 if (pseudoStyle) 159 styleForValuePart = RenderStyle::clone(pseudoStyle); 160 else 161 styleForValuePart = RenderStyle::create(); 162 163 if (parentStyle) 164 styleForValuePart->inheritFrom(parentStyle); 165 styleForValuePart->setDisplay(BLOCK); 166 styleForValuePart->setAppearance(ProgressBarValuePart); 167 return styleForValuePart.release(); 75 168 } 76 169 … … 100 193 m_animationRepeatInterval = theme()->animationRepeatIntervalForProgressBar(this); 101 194 102 bool animating = m_animationDuration > 0;195 bool animating = style()->hasAppearance() && m_animationDuration > 0; 103 196 if (animating == m_animating) 104 197 return; -
trunk/WebCore/rendering/RenderProgress.h
r57494 r58228 28 28 29 29 class HTMLProgressElement; 30 class ProgressValueElement; 30 31 31 32 class RenderProgress : public RenderBlock { 32 33 public: 33 34 RenderProgress(HTMLProgressElement*); 35 virtual ~RenderProgress(); 36 34 37 double position() { return m_position; } 35 38 double animationProgress(); … … 43 46 virtual void updateFromElement(); 44 47 virtual void paint(PaintInfo&, int tx, int ty); 48 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); 45 49 46 50 void animationTimerFired(Timer<RenderProgress>*); 47 51 void updateAnimationState(); 52 void updateValuePartState(); 53 PassRefPtr<RenderStyle> createStyleForValuePart(RenderStyle*); 48 54 49 55 double m_position; … … 53 59 bool m_animating; 54 60 Timer<RenderProgress> m_animationTimer; 61 RefPtr<ProgressValueElement> m_valuePart; 55 62 }; 56 63 -
trunk/WebCore/rendering/RenderTheme.cpp
r56850 r58228 614 614 case ListboxPart: 615 615 case MenulistPart: 616 case ProgressBarPart: 616 617 // FIXME: Uncomment this when making search fields style-able. 617 618 // case SearchFieldPart: -
trunk/WebCore/rendering/style/RenderStyleConstants.h
r57292 r58228 75 75 MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON, MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON, 76 76 MEDIA_CONTROLS_STATUS_DISPLAY, SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER, 77 INPUT_LIST_BUTTON, INNER_SPIN_BUTTON, OUTER_SPIN_BUTTON, VISITED_LINK, 77 INPUT_LIST_BUTTON, INNER_SPIN_BUTTON, OUTER_SPIN_BUTTON, VISITED_LINK, PROGRESS_BAR_VALUE, 78 78 79 79 AFTER_LAST_INTERNAL_PSEUDOID,
Note: See TracChangeset
for help on using the changeset viewer.