Changeset 59217 in webkit
- Timestamp:
- May 12, 2010 1:51:24 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r59216 r59217 1 2010-05-12 MORITA Hajime <morrita@google.com> 2 3 Reviewed by Kent Tamura. 4 5 [Chromium] Support HTML5 <progress> element on Windows. 6 https://bugs.webkit.org/show_bug.cgi?id=37308 7 8 Extended ChromiumBridge to handle progress bar painting, 9 and added delegations to it. 10 11 No new tests. Test cases should be shared with existing ones for 12 progress element. Expectaions will be added after PROGRESS_TAG is 13 enabled on Chromium tree. 14 15 * platform/chromium/ChromiumBridge.h: 16 * rendering/RenderProgress.cpp: 17 (WebCore::RenderProgress::animationProgress): 18 (WebCore::RenderProgress::isDeterminate): 19 * rendering/RenderProgress.h: 20 (WebCore::RenderProgress::position): 21 * rendering/RenderThemeChromiumWin.cpp: 22 (WebCore::RenderThemeChromiumWin::animationRepeatIntervalForProgressBar): 23 (WebCore::RenderThemeChromiumWin::animationDurationForProgressBar): 24 (WebCore::RenderThemeChromiumWin::adjustProgressBarStyle): 25 (WebCore::RenderThemeChromiumWin::paintProgressBar): 26 * rendering/RenderThemeChromiumWin.h: 27 1 28 2010-05-12 Marcus Bulach <bulach@chromium.org> 2 29 -
trunk/WebCore/platform/chromium/ChromiumBridge.h
r58599 r59217 222 222 static void paintTrackbar( 223 223 GraphicsContext*, int part, int state, int classicState, const IntRect&); 224 static void paintProgressBar( 225 GraphicsContext*, const IntRect& barRect, int valuePart, const IntRect& valueRect); 224 226 #endif 225 227 -
trunk/WebCore/rendering/RenderProgress.cpp
r58914 r59217 168 168 } 169 169 170 double RenderProgress::animationProgress() 170 double RenderProgress::animationProgress() const 171 171 { 172 172 return m_animating ? (fmod((currentTime() - m_animationStartTime), m_animationDuration) / m_animationDuration) : 0; 173 } 174 175 bool RenderProgress::isDeterminate() const 176 { 177 return 0 <= position(); 173 178 } 174 179 -
trunk/WebCore/rendering/RenderProgress.h
r58228 r59217 35 35 virtual ~RenderProgress(); 36 36 37 double position() { return m_position; } 38 double animationProgress(); 39 37 double position() const { return m_position; } 38 double animationProgress() const; 39 bool isDeterminate() const; 40 40 41 HTMLProgressElement* progressElement() const; 41 42 -
trunk/WebCore/rendering/RenderThemeChromiumWin.cpp
r54509 r59217 39 39 #include "MediaControlElements.h" 40 40 #include "RenderBox.h" 41 #include "RenderProgress.h" 41 42 #include "RenderSlider.h" 42 43 #include "ScrollbarTheme.h" … … 654 655 } 655 656 657 #if ENABLE(PROGRESS_TAG) 658 659 // MSDN says that update intervals for the bar is 30ms. 660 // http://msdn.microsoft.com/en-us/library/bb760842(v=VS.85).aspx 661 static const double progressAnimationFrameRate = 0.033; 662 // There is no documentation about the animation speed of 663 // the indeterminate progress bar. So we just guess it. 664 static const double progressAnimationNumFrames = 60; 665 666 double RenderThemeChromiumWin::animationRepeatIntervalForProgressBar(RenderProgress*) const 667 { 668 return progressAnimationFrameRate; 669 } 670 671 double RenderThemeChromiumWin::animationDurationForProgressBar(RenderProgress* renderProgress) const 672 { 673 if (renderProgress->isDeterminate()) 674 return 0; 675 return progressAnimationNumFrames * progressAnimationFrameRate; 676 } 677 678 void RenderThemeChromiumWin::adjustProgressBarStyle(CSSStyleSelector*, RenderStyle*, Element*) const 679 { 680 } 681 682 bool RenderThemeChromiumWin::paintProgressBar(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) 683 { 684 RenderProgress* renderProgress = toRenderProgress(o); 685 686 int valuePart; 687 IntRect valueRect; 688 if (renderProgress->isDeterminate()) { 689 valuePart = PP_FILL; 690 int dx = r.width() * renderProgress->position(); 691 if (renderProgress->style()->direction() == RTL) 692 valueRect = IntRect(r.x() + r.width() - dx, r.y(), dx, r.height()); 693 else 694 valueRect = IntRect(r.x(), r.y(), dx, r.height()); 695 } else { 696 valuePart = PP_MOVEOVERLAY; 697 int dx = r.width() * renderProgress->animationProgress() * 2 - r.width(); 698 valueRect = IntRect(r.x() + dx, r.y(), r.width(), r.height()); 699 } 700 701 ThemePainter painter(i.context, r); 702 ChromiumBridge::paintProgressBar(painter.context(), 703 r, 704 valuePart, 705 valueRect); 706 return true; 707 } 708 709 #endif 710 656 711 } // namespace WebCore -
trunk/WebCore/rendering/RenderThemeChromiumWin.h
r56862 r59217 87 87 static void setDefaultFontSize(int); 88 88 89 90 #if ENABLE(PROGRESS_TAG) 91 virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; 92 virtual double animationDurationForProgressBar(RenderProgress*) const; 93 virtual void adjustProgressBarStyle(CSSStyleSelector*, RenderStyle*, Element*) const; 94 virtual bool paintProgressBar(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); 95 #endif 96 89 97 protected: 90 98 virtual double caretBlinkIntervalInternal() const; -
trunk/WebKit/chromium/ChangeLog
r59215 r59217 1 2010-05-12 MORITA Hajime <morrita@google.com> 2 3 Reviewed by Kent Tamura. 4 5 [Chromium] Support HTML5 <progress> element on Windows. 6 https://bugs.webkit.org/show_bug.cgi?id=37308 7 8 Extended ChromiumBridge to handle progress bar painting, 9 and added delegations to it. 10 11 No new tests. Test cases should be shared with existing ones for 12 progress element. Expectaions will be added after PROGRESS_TAG is 13 enabled on Chromium tree. 14 15 * public/WebThemeEngine.h: 16 (WebKit::WebThemeEngine::paintProgressBar): 17 * src/ChromiumBridge.cpp: 18 (WebCore::ChromiumBridge::paintProgressBar): 19 1 20 2010-05-12 Marcus Bulach <bulach@chromium.org> 2 21 -
trunk/WebKit/chromium/public/WebThemeEngine.h
r59110 r59217 76 76 WebCanvas*, int part, int state, int classicState, 77 77 const WebRect&) = 0; 78 79 virtual void paintProgressBar( 80 WebCanvas*, const WebRect& barRect, 81 int valuePart, const WebRect& valueRect) {} 82 78 83 #endif 79 84 }; -
trunk/WebKit/chromium/src/ChromiumBridge.cpp
r58599 r59217 673 673 } 674 674 675 void ChromiumBridge::paintProgressBar( 676 GraphicsContext* gc, const IntRect& barRect, int valuePart, const IntRect& valueRect) 677 { 678 webKitClient()->themeEngine()->paintProgressBar( 679 gc->platformContext()->canvas(), barRect, valuePart, valueRect); 680 } 681 675 682 #endif 676 683
Note: See TracChangeset
for help on using the changeset viewer.