Changeset 59217 in webkit


Ignore:
Timestamp:
May 12, 2010 1:51:24 AM (14 years ago)
Author:
morrita@google.com
Message:

2010-05-12 MORITA Hajime <morrita@google.com>

Reviewed by Kent Tamura.

[Chromium] Support HTML5 <progress> element on Windows.
https://bugs.webkit.org/show_bug.cgi?id=37308

Extended ChromiumBridge to handle progress bar painting,
and added delegations to it.

No new tests. Test cases should be shared with existing ones for
progress element. Expectaions will be added after PROGRESS_TAG is
enabled on Chromium tree.

  • platform/chromium/ChromiumBridge.h:
  • rendering/RenderProgress.cpp: (WebCore::RenderProgress::animationProgress): (WebCore::RenderProgress::isDeterminate):
  • rendering/RenderProgress.h: (WebCore::RenderProgress::position):
  • rendering/RenderThemeChromiumWin.cpp: (WebCore::RenderThemeChromiumWin::animationRepeatIntervalForProgressBar): (WebCore::RenderThemeChromiumWin::animationDurationForProgressBar): (WebCore::RenderThemeChromiumWin::adjustProgressBarStyle): (WebCore::RenderThemeChromiumWin::paintProgressBar):
  • rendering/RenderThemeChromiumWin.h:

2010-05-12 MORITA Hajime <morrita@google.com>

Reviewed by Kent Tamura.

[Chromium] Support HTML5 <progress> element on Windows.
https://bugs.webkit.org/show_bug.cgi?id=37308

Extended ChromiumBridge to handle progress bar painting,
and added delegations to it.

No new tests. Test cases should be shared with existing ones for
progress element. Expectaions will be added after PROGRESS_TAG is
enabled on Chromium tree.

  • public/WebThemeEngine.h: (WebKit::WebThemeEngine::paintProgressBar):
  • src/ChromiumBridge.cpp: (WebCore::ChromiumBridge::paintProgressBar):
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r59216 r59217  
     12010-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
    1282010-05-12  Marcus Bulach  <bulach@chromium.org>
    229
  • trunk/WebCore/platform/chromium/ChromiumBridge.h

    r58599 r59217  
    222222        static void paintTrackbar(
    223223            GraphicsContext*, int part, int state, int classicState, const IntRect&);
     224        static void paintProgressBar(
     225            GraphicsContext*, const IntRect& barRect, int valuePart, const IntRect& valueRect);
    224226#endif
    225227
  • trunk/WebCore/rendering/RenderProgress.cpp

    r58914 r59217  
    168168}
    169169
    170 double RenderProgress::animationProgress()
     170double RenderProgress::animationProgress() const
    171171{
    172172    return m_animating ? (fmod((currentTime() - m_animationStartTime), m_animationDuration) / m_animationDuration) : 0;
     173}
     174
     175bool RenderProgress::isDeterminate() const
     176{
     177    return 0 <= position();
    173178}
    174179
  • trunk/WebCore/rendering/RenderProgress.h

    r58228 r59217  
    3535    virtual ~RenderProgress();
    3636
    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
    4041    HTMLProgressElement* progressElement() const;
    4142
  • trunk/WebCore/rendering/RenderThemeChromiumWin.cpp

    r54509 r59217  
    3939#include "MediaControlElements.h"
    4040#include "RenderBox.h"
     41#include "RenderProgress.h"
    4142#include "RenderSlider.h"
    4243#include "ScrollbarTheme.h"
     
    654655}
    655656
     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
     661static 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.
     664static const double progressAnimationNumFrames = 60;
     665
     666double RenderThemeChromiumWin::animationRepeatIntervalForProgressBar(RenderProgress*) const
     667{
     668    return progressAnimationFrameRate;
     669}
     670
     671double RenderThemeChromiumWin::animationDurationForProgressBar(RenderProgress* renderProgress) const
     672{
     673    if (renderProgress->isDeterminate())
     674        return 0;
     675    return progressAnimationNumFrames * progressAnimationFrameRate;
     676}
     677
     678void RenderThemeChromiumWin::adjustProgressBarStyle(CSSStyleSelector*, RenderStyle*, Element*) const
     679{
     680}
     681
     682bool 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
    656711} // namespace WebCore
  • trunk/WebCore/rendering/RenderThemeChromiumWin.h

    r56862 r59217  
    8787        static void setDefaultFontSize(int);
    8888
     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
    8997    protected:
    9098        virtual double caretBlinkIntervalInternal() const;
  • trunk/WebKit/chromium/ChangeLog

    r59215 r59217  
     12010-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
    1202010-05-12  Marcus Bulach  <bulach@chromium.org>
    221
  • trunk/WebKit/chromium/public/WebThemeEngine.h

    r59110 r59217  
    7676        WebCanvas*, int part, int state, int classicState,
    7777        const WebRect&) = 0;
     78
     79    virtual void paintProgressBar(
     80        WebCanvas*, const WebRect& barRect,
     81        int valuePart, const WebRect& valueRect) {}
     82
    7883#endif
    7984};
  • trunk/WebKit/chromium/src/ChromiumBridge.cpp

    r58599 r59217  
    673673}
    674674
     675void 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
    675682#endif
    676683
Note: See TracChangeset for help on using the changeset viewer.