diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/rendering/RenderMarquee.cpp | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/rendering/RenderMarquee.cpp')
-rw-r--r-- | Source/WebCore/rendering/RenderMarquee.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/Source/WebCore/rendering/RenderMarquee.cpp b/Source/WebCore/rendering/RenderMarquee.cpp index bdea97929..6059d26d1 100644 --- a/Source/WebCore/rendering/RenderMarquee.cpp +++ b/Source/WebCore/rendering/RenderMarquee.cpp @@ -59,10 +59,11 @@ using namespace HTMLNames; RenderMarquee::RenderMarquee(RenderLayer* l) : m_layer(l), m_currentLoop(0) , m_totalLoops(0) - , m_timer(this, &RenderMarquee::timerFired) + , m_timer(*this, &RenderMarquee::timerFired) , m_start(0), m_end(0), m_speed(0), m_reset(false) , m_suspended(false), m_stopped(false), m_direction(MAUTO) { + l->setConstrainsScrollingToContentEdge(false); } RenderMarquee::~RenderMarquee() @@ -73,8 +74,8 @@ int RenderMarquee::marqueeSpeed() const { int result = m_layer->renderer().style().marqueeSpeed(); Element* element = m_layer->renderer().element(); - if (element && element->hasTagName(marqueeTag)) - result = std::max(result, toHTMLMarqueeElement(element)->minimumDelay()); + if (is<HTMLMarqueeElement>(element)) + result = std::max(result, downcast<HTMLMarqueeElement>(*element).minimumDelay()); return result; } @@ -109,7 +110,7 @@ int RenderMarquee::computePosition(EMarqueeDirection dir, bool stopAtContentEdge { RenderBox* box = m_layer->renderBox(); ASSERT(box); - RenderStyle& boxStyle = box->style(); + auto& boxStyle = box->style(); if (isHorizontal()) { bool ltr = boxStyle.isLeftToRightDirection(); LayoutUnit clientWidth = box->clientWidth(); @@ -135,7 +136,7 @@ int RenderMarquee::computePosition(EMarqueeDirection dir, bool stopAtContentEdge } else { int contentHeight = box->layoutOverflowRect().maxY() - box->borderTop() + box->paddingBottom(); - int clientHeight = box->clientHeight(); + int clientHeight = roundToInt(box->clientHeight()); if (dir == MUP) { if (stopAtContentEdge) return std::min(contentHeight - clientHeight, 0); @@ -158,9 +159,9 @@ void RenderMarquee::start() if (!m_suspended && !m_stopped) { if (isHorizontal()) - m_layer->scrollToOffset(IntSize(m_start, 0)); + m_layer->scrollToOffset(ScrollOffset(m_start, 0)); else - m_layer->scrollToOffset(IntSize(0, m_start)); + m_layer->scrollToOffset(ScrollOffset(0, m_start)); } else { m_suspended = false; @@ -196,7 +197,7 @@ void RenderMarquee::updateMarqueePosition() void RenderMarquee::updateMarqueeStyle() { - RenderStyle& style = m_layer->renderer().style(); + auto& style = m_layer->renderer().mutableStyle(); if (m_direction != style.marqueeDirection() || (m_totalLoops != style.marqueeLoopCount() && m_currentLoop >= m_totalLoops)) m_currentLoop = 0; // When direction changes or our loopCount is a smaller number than our current loop, reset our loop. @@ -240,7 +241,7 @@ void RenderMarquee::updateMarqueeStyle() m_timer.stop(); } -void RenderMarquee::timerFired(Timer<RenderMarquee>&) +void RenderMarquee::timerFired() { if (m_layer->renderer().view().needsLayout()) return; @@ -271,9 +272,9 @@ void RenderMarquee::timerFired(Timer<RenderMarquee>&) addIncrement = !addIncrement; } bool positive = range > 0; - int clientSize = (isHorizontal() ? m_layer->renderBox()->clientWidth() : m_layer->renderBox()->clientHeight()); + int clientSize = (isHorizontal() ? roundToInt(m_layer->renderBox()->clientWidth()) : roundToInt(m_layer->renderBox()->clientHeight())); int increment = abs(intValueForLength(m_layer->renderer().style().marqueeIncrement(), clientSize)); - int currentPos = (isHorizontal() ? m_layer->scrollXOffset() : m_layer->scrollYOffset()); + int currentPos = (isHorizontal() ? m_layer->scrollOffset().x() : m_layer->scrollOffset().y()); newPos = currentPos + (addIncrement ? increment : -increment); if (positive) newPos = std::min(newPos, endPoint); |