| Differences between
and this patch
- a/WebCore/ChangeLog +22 lines
Lines 1-3 a/WebCore/ChangeLog_sec1
1
2010-04-08  MORITA Hajime  <morrita@google.com>
2
3
        Reviewed by NOBODY (OOPS!).
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/RenderThemeChromiumWin.cpp:
17
        (WebCore::RenderThemeChromiumWin::animationRepeatIntervalForProgressBar):
18
        (WebCore::RenderThemeChromiumWin::animationDurationForProgressBar):
19
        (WebCore::RenderThemeChromiumWin::adjustProgressBarStyle):
20
        (WebCore::RenderThemeChromiumWin::paintProgressBar):
21
        * rendering/RenderThemeChromiumWin.h:
22
1
2010-04-06  Nicolas Weber  <thakis@chromium.org>
23
2010-04-06  Nicolas Weber  <thakis@chromium.org>
2
24
3
        Reviewed by Dimitri Glazkov.
25
        Reviewed by Dimitri Glazkov.
- a/WebCore/platform/chromium/ChromiumBridge.h +2 lines
Lines 215-220 namespace WebCore { a/WebCore/platform/chromium/ChromiumBridge.h_sec1
215
            GraphicsContext*, int part, int state, int classicState, const IntRect&, const Color&, bool fillContentArea, bool drawEdges);
215
            GraphicsContext*, int part, int state, int classicState, const IntRect&, const Color&, bool fillContentArea, bool drawEdges);
216
        static void paintTrackbar(
216
        static void paintTrackbar(
217
            GraphicsContext*, int part, int state, int classicState, const IntRect&);
217
            GraphicsContext*, int part, int state, int classicState, const IntRect&);
218
        static void paintProgressBar(
219
            GraphicsContext*, int barPart, int barState, const IntRect& barRect, int fillPart, int fillState, const IntRect& fillRect);
218
#endif
220
#endif
219
221
220
        // Trace Event --------------------------------------------------------
222
        // Trace Event --------------------------------------------------------
- a/WebCore/rendering/RenderThemeChromiumWin.cpp +52 lines
Lines 38-43 a/WebCore/rendering/RenderThemeChromiumWin.cpp_sec1
38
#include "HTMLNames.h"
38
#include "HTMLNames.h"
39
#include "MediaControlElements.h"
39
#include "MediaControlElements.h"
40
#include "RenderBox.h"
40
#include "RenderBox.h"
41
#include "RenderProgress.h"
41
#include "RenderSlider.h"
42
#include "RenderSlider.h"
42
#include "ScrollbarTheme.h"
43
#include "ScrollbarTheme.h"
43
#include "TransparencyWin.h"
44
#include "TransparencyWin.h"
Lines 653-656 bool RenderThemeChromiumWin::paintTextFieldInternal(RenderObject* o, a/WebCore/rendering/RenderThemeChromiumWin.cpp_sec2
653
    return false;
654
    return false;
654
}
655
}
655
656
657
#if ENABLE(PROGRESS_TAG)
658
659
static const double progressAnimationFrameRate = 0.033;
660
static const double progressAnimationNumFrames = 60;
661
662
double RenderThemeChromiumWin::animationRepeatIntervalForProgressBar(RenderProgress*) const
663
{
664
    return progressAnimationFrameRate;
665
}
666
667
double RenderThemeChromiumWin::animationDurationForProgressBar(RenderProgress* o) const
668
{
669
    if (o->position() < 0)
670
        return progressAnimationNumFrames * progressAnimationFrameRate;
671
    return 0.0;
672
}
673
674
void RenderThemeChromiumWin::adjustProgressBarStyle(CSSStyleSelector*, RenderStyle*, Element*) const
675
{
676
}
677
678
bool RenderThemeChromiumWin::paintProgressBar(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
679
{
680
    RenderProgress* renderProgress = toRenderProgress(o);
681
682
    int fillPart;
683
    IntRect fillRect;
684
    if (renderProgress->position() < 0) {
685
        double p = renderProgress->animationProgress();
686
        int width = r.width() / 2;
687
        int dx = p > 0.5 ? r.width() * (1.0 - p) : r.width() * p;
688
        fillRect = IntRect(r.x() + dx, r.y(), width, r.height());
689
        fillPart = PP_MOVEOVERLAY;
690
    } else {
691
        fillRect = IntRect(r.x(), r.y(), r.width() * renderProgress->position(), r.height());
692
        fillPart = PP_FILL;
693
    }
694
695
    WebCore::ThemePainter painter(i.context, r);
696
    ChromiumBridge::paintProgressBar(painter.context(),
697
                                     PP_BAR,
698
                                     0,
699
                                     r, 
700
                                     fillPart,
701
                                     0,
702
                                     fillRect);
703
    return true;
704
}
705
706
#endif
707
656
} // namespace WebCore
708
} // namespace WebCore
- a/WebCore/rendering/RenderThemeChromiumWin.h +8 lines
Lines 86-91 namespace WebCore { a/WebCore/rendering/RenderThemeChromiumWin.h_sec1
86
        // See comment in RenderThemeChromiumSkia::setDefaultFontSize() regarding ugliness of this hack.
86
        // See comment in RenderThemeChromiumSkia::setDefaultFontSize() regarding ugliness of this hack.
87
        static void setDefaultFontSize(int);
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
    protected:
97
    protected:
90
        virtual double caretBlinkIntervalInternal() const;
98
        virtual double caretBlinkIntervalInternal() const;
91
99
- a/WebKit/chromium/ChangeLog +16 lines
Lines 1-3 a/WebKit/chromium/ChangeLog_sec1
1
2010-04-08  MORITA Hajime  <morrita@google.com>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        [Chromium] Support HTML5 <progress> element on Windows.
6
        https://bugs.webkit.org/show_bug.cgi?id=37308
7
8
        Extended ChromiumBridge and WebThemeEngine interface
9
        to handle progress bar painting. implementation will 
10
        shit on Chromium tree.
11
        
12
        * public/win/WebThemeEngine.h:
13
        (WebKit::WebThemeEngine::paintProgressBar):
14
        * src/ChromiumBridge.cpp:
15
        (WebCore::ChromiumBridge::paintProgressBar):
16
1
2010-04-06  Nicolas Weber  <thakis@chromium.org>
17
2010-04-06  Nicolas Weber  <thakis@chromium.org>
2
18
3
        Reviewed by Dimitri Glazkov.
19
        Reviewed by Dimitri Glazkov.
- a/WebKit/chromium/public/win/WebThemeEngine.h +4 lines
Lines 73-78 public: a/WebKit/chromium/public/win/WebThemeEngine.h_sec1
73
    virtual void paintTrackbar(
73
    virtual void paintTrackbar(
74
        WebCanvas*, int part, int state, int classicState,
74
        WebCanvas*, int part, int state, int classicState,
75
        const WebRect&) = 0;
75
        const WebRect&) = 0;
76
77
    virtual void paintProgressBar(
78
        WebCanvas*, int barPart, int barState, const WebRect& barRect, 
79
        int fillPart, int fillState, const WebRect& fillRect) {} // FIXME: make pure virtual after implementation landed.
76
};
80
};
77
81
78
} // namespace WebKit
82
} // namespace WebKit
- a/WebKit/chromium/src/ChromiumBridge.cpp +7 lines
Lines 616-621 void ChromiumBridge::paintTrackbar( a/WebKit/chromium/src/ChromiumBridge.cpp_sec1
616
        gc->platformContext()->canvas(), part, state, classicState, rect);
616
        gc->platformContext()->canvas(), part, state, classicState, rect);
617
}
617
}
618
618
619
void ChromiumBridge::paintProgressBar(
620
    GraphicsContext* gc, int barPart, int barState, const IntRect& barRect, int fillPart, int fillState, const IntRect& fillRect)
621
{
622
    webKitClient()->themeEngine()->paintProgressBar(
623
        gc->platformContext()->canvas(), barPart, barState, barRect, fillPart, fillState, fillRect);
624
}
625
619
#endif
626
#endif
620
627
621
// Trace Event ----------------------------------------------------------------
628
// Trace Event ----------------------------------------------------------------

Return to Bug 37308