OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 { | 67 { |
68 return m_animating ? (fmod((currentTime() - m_animationStartTime), m_animati
onDuration) / m_animationDuration) : 0; | 68 return m_animating ? (fmod((currentTime() - m_animationStartTime), m_animati
onDuration) / m_animationDuration) : 0; |
69 } | 69 } |
70 | 70 |
71 bool LayoutProgress::isDeterminate() const | 71 bool LayoutProgress::isDeterminate() const |
72 { | 72 { |
73 return (HTMLProgressElement::IndeterminatePosition != position() | 73 return (HTMLProgressElement::IndeterminatePosition != position() |
74 && HTMLProgressElement::InvalidPosition != position()); | 74 && HTMLProgressElement::InvalidPosition != position()); |
75 } | 75 } |
76 | 76 |
| 77 bool LayoutProgress::isAnimationTimerActive() const |
| 78 { |
| 79 return m_animationTimer.isActive(); |
| 80 } |
| 81 |
| 82 bool LayoutProgress::isAnimating() const |
| 83 { |
| 84 return m_animating; |
| 85 } |
| 86 |
77 void LayoutProgress::animationTimerFired(Timer<LayoutProgress>*) | 87 void LayoutProgress::animationTimerFired(Timer<LayoutProgress>*) |
78 { | 88 { |
79 setShouldDoFullPaintInvalidation(); | 89 setShouldDoFullPaintInvalidation(); |
80 if (!m_animationTimer.isActive() && m_animating) | 90 if (!m_animationTimer.isActive() && m_animating) |
81 m_animationTimer.startOneShot(m_animationRepeatInterval, BLINK_FROM_HERE
); | 91 m_animationTimer.startOneShot(m_animationRepeatInterval, BLINK_FROM_HERE
); |
82 } | 92 } |
83 | 93 |
84 void LayoutProgress::updateAnimationState() | 94 void LayoutProgress::updateAnimationState() |
85 { | 95 { |
86 m_animationDuration = LayoutTheme::theme().animationDurationForProgressBar()
; | 96 m_animationDuration = LayoutTheme::theme().animationDurationForProgressBar()
; |
87 m_animationRepeatInterval = LayoutTheme::theme().animationRepeatIntervalForP
rogressBar(); | 97 m_animationRepeatInterval = LayoutTheme::theme().animationRepeatIntervalForP
rogressBar(); |
88 | 98 |
89 bool animating = style()->hasAppearance() && m_animationDuration > 0; | 99 bool animating = !isDeterminate() && style()->hasAppearance() && m_animation
Duration > 0; |
90 if (animating == m_animating) | 100 if (animating == m_animating) |
91 return; | 101 return; |
92 | 102 |
93 m_animating = animating; | 103 m_animating = animating; |
94 if (m_animating) { | 104 if (m_animating) { |
95 m_animationStartTime = currentTime(); | 105 m_animationStartTime = currentTime(); |
96 m_animationTimer.startOneShot(m_animationRepeatInterval, BLINK_FROM_HERE
); | 106 m_animationTimer.startOneShot(m_animationRepeatInterval, BLINK_FROM_HERE
); |
97 } else { | 107 } else { |
98 m_animationTimer.stop(); | 108 m_animationTimer.stop(); |
99 } | 109 } |
100 } | 110 } |
101 | 111 |
102 HTMLProgressElement* LayoutProgress::progressElement() const | 112 HTMLProgressElement* LayoutProgress::progressElement() const |
103 { | 113 { |
104 if (!node()) | 114 if (!node()) |
105 return nullptr; | 115 return nullptr; |
106 | 116 |
107 if (isHTMLProgressElement(*node())) | 117 if (isHTMLProgressElement(*node())) |
108 return toHTMLProgressElement(node()); | 118 return toHTMLProgressElement(node()); |
109 | 119 |
110 ASSERT(node()->shadowHost()); | 120 ASSERT(node()->shadowHost()); |
111 return toHTMLProgressElement(node()->shadowHost()); | 121 return toHTMLProgressElement(node()->shadowHost()); |
112 } | 122 } |
113 | 123 |
114 } // namespace blink | 124 } // namespace blink |
OLD | NEW |