Commit 4717bbe4 authored by eric@webkit.org's avatar eric@webkit.org
Browse files

Reviewed by Cameron Zwarich.

        Fix warnings and errors seen on Qt bot.
        Including one correctness fix for ThreadingQt.
        According to the Qt 4.4 docs, we were always passing
        seconds to "wait()" when we should have been passing
        milliseconds.

        Lots of float <-> int conversion warnings.

        * css/CSSCursorImageValue.cpp:
        (WebCore::CSSCursorImageValue::updateIfSVGCursorIsUsed):
        * dom/Element.cpp:
        (WebCore::adjustForLocalZoom):
        (WebCore::adjustForAbsoluteZoom):
        (WebCore::Element::setScrollLeft):
        (WebCore::Element::setScrollTop):
        * dom/EventTargetNode.cpp:
        (WebCore::EventTargetNode::dispatchMouseEvent):
        * loader/CachedImage.cpp:
        (WebCore::CachedImage::imageRect):
        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::innerHeight):
        (WebCore::DOMWindow::innerWidth):
        (WebCore::DOMWindow::scrollX):
        (WebCore::DOMWindow::scrollY):
        (WebCore::DOMWindow::scrollTo):
        * page/EventHandler.cpp:
        (WebCore::scrollAndAcceptEvent):
        * plugins/npapi.cpp:
        * plugins/qt/PluginViewQt.cpp:
        (WebCore::PluginView::getValue):
        (WebCore::PluginView::~PluginView):
        * rendering/RenderReplaced.cpp:
        (WebCore::RenderReplaced::intrinsicSizeChanged):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@35598 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6d854574
......@@ -217,20 +217,20 @@ void ThreadCondition::wait(Mutex& mutex)
ASSERT(false);
}
bool ThreadCondition::timedWait(Mutex& mutex, double interval)
bool ThreadCondition::timedWait(Mutex& mutex, double secondsToWait)
{
if (interval < 0.0) {
if (secondsToWait < 0.0) {
wait(mutex);
return true;
}
int intervalSeconds = static_cast<int>(interval);
int intervalMicroseconds = static_cast<int>((interval - intervalSeconds) * 1000000.0);
int intervalSeconds = static_cast<int>(secondsToWait);
int intervalMicroseconds = static_cast<int>((secondsToWait - intervalSeconds) * 1000000.0);
// Current time comes in sec/microsec
timeval currentTime;
gettimeofday(&currentTime, NULL);
// Target time comes in sec/nanosec
timespec targetTime;
targetTime.tv_sec = currentTime.tv_sec + intervalSeconds;
......
......@@ -213,9 +213,15 @@ void ThreadCondition::wait(Mutex& mutex)
m_condition->wait(mutex.impl());
}
bool ThreadCondition::timedWait(Mutex& mutex, double interval)
bool ThreadCondition::timedWait(Mutex& mutex, double secondsToWait)
{
return m_condition->wait(mutex.impl(), interval);
if (secondsToWait < 0.0) {
wait(mutex);
return true;
}
unsigned long millisecondsToWait = static_cast<unsigned long>(secondsToWait * 1000.0);
return m_condition->wait(mutex.impl(), millisecondsToWait);
}
void ThreadCondition::signal()
......
......@@ -6,6 +6,44 @@
(WebCore::PluginView::getValue):
(WebCore::PluginView::~PluginView):
 
2008-08-06 Eric Seidel <eric@webkit.org>
Reviewed by Cameron Zwarich.
Fix warnings and errors seen on Qt bot.
Including one correctness fix for ThreadingQt.
According to the Qt 4.4 docs, we were always passing
seconds to "wait()" when we should have been passing
milliseconds.
Lots of float <-> int conversion warnings.
* css/CSSCursorImageValue.cpp:
(WebCore::CSSCursorImageValue::updateIfSVGCursorIsUsed):
* dom/Element.cpp:
(WebCore::adjustForLocalZoom):
(WebCore::adjustForAbsoluteZoom):
(WebCore::Element::setScrollLeft):
(WebCore::Element::setScrollTop):
* dom/EventTargetNode.cpp:
(WebCore::EventTargetNode::dispatchMouseEvent):
* loader/CachedImage.cpp:
(WebCore::CachedImage::imageRect):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::innerHeight):
(WebCore::DOMWindow::innerWidth):
(WebCore::DOMWindow::scrollX):
(WebCore::DOMWindow::scrollY):
(WebCore::DOMWindow::scrollTo):
* page/EventHandler.cpp:
(WebCore::scrollAndAcceptEvent):
* plugins/npapi.cpp:
* plugins/qt/PluginViewQt.cpp:
(WebCore::PluginView::getValue):
(WebCore::PluginView::~PluginView):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::intrinsicSizeChanged):
2008-08-06 Eric Seidel <eric@webkit.org>
 
Build fix only, no review.
......@@ -86,11 +86,11 @@ bool CSSCursorImageValue::updateIfSVGCursorIsUsed(Element* element)
return false;
if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, element->document())) {
int x = roundf(cursorElement->x().value(0));
m_hotspot.setX(x);
float x = roundf(cursorElement->x().value(0));
m_hotspot.setX(static_cast<int>(x));
int y = roundf(cursorElement->y().value(0));
m_hotspot.setY(y);
float y = roundf(cursorElement->y().value(0));
m_hotspot.setY(static_cast<int>(y));
if (cachedImageURL() != element->document()->completeURL(cursorElement->href()))
clearCachedImage();
......
......@@ -319,7 +319,7 @@ static int adjustForLocalZoom(int value, RenderObject* renderer)
float zoomFactor = localZoomForRenderer(renderer);
if (zoomFactor == 1.0f)
return value;
return value / zoomFactor;
return static_cast<int>(value / zoomFactor);
}
static int adjustForAbsoluteZoom(int value, RenderObject* renderer)
......@@ -327,7 +327,7 @@ static int adjustForAbsoluteZoom(int value, RenderObject* renderer)
float zoomFactor = renderer->style()->effectiveZoom();
if (zoomFactor == 1.0f)
return value;
return value / zoomFactor;
return static_cast<int>(value / zoomFactor);
}
int Element::offsetLeft()
......@@ -446,15 +446,15 @@ int Element::scrollTop()
void Element::setScrollLeft(int newLeft)
{
document()->updateLayoutIgnorePendingStylesheets();
if (RenderObject *rend = renderer())
rend->setScrollLeft(newLeft * rend->style()->effectiveZoom());
if (RenderObject* rend = renderer())
rend->setScrollLeft(static_cast<int>(newLeft * rend->style()->effectiveZoom()));
}
void Element::setScrollTop(int newTop)
{
document()->updateLayoutIgnorePendingStylesheets();
if (RenderObject *rend = renderer())
rend->setScrollTop(newTop * rend->style()->effectiveZoom());
if (RenderObject* rend = renderer())
rend->setScrollTop(static_cast<int>(newTop * rend->style()->effectiveZoom()));
}
int Element::scrollWidth()
......
......@@ -300,8 +300,8 @@ bool EventTargetNode::dispatchMouseEvent(const AtomicString& eventType, int butt
float pageZoom = frame->pageZoomFactor();
if (pageZoom != 1.0f) {
// Adjust our pageX and pageY to account for the page zoom.
pageX /= pageZoom;
pageY /= pageZoom;
pageX = lroundf(pageX / pageZoom);
pageY = lroundf(pageY / pageZoom);
}
}
......
......@@ -169,19 +169,27 @@ IntRect CachedImage::imageRect(float multiplier) const
{
if (!m_image)
return IntRect();
if (multiplier == 1.0f)
if (multiplier == 1.0f || (!m_image->hasRelativeWidth() && !m_image->hasRelativeHeight()))
return m_image->rect();
float widthMultiplier = (m_image->hasRelativeWidth() ? 1.0f : multiplier);
float heightMultiplier = (m_image->hasRelativeHeight() ? 1.0f : multiplier);
// Don't let images that have a width/height >= 1 shrink below 1 when zoomed.
bool hasWidth = m_image->rect().width() > 0;
bool hasHeight = m_image->rect().height() > 0;
int width = m_image->rect().width() * (m_image->hasRelativeWidth() ? 1.0f : multiplier);
int height = m_image->rect().height() * (m_image->hasRelativeHeight() ? 1.0f : multiplier);
int width = static_cast<int>(m_image->rect().width() * widthMultiplier);
int height = static_cast<int>(m_image->rect().height() * heightMultiplier);
if (hasWidth)
width = max(1, width);
if (hasHeight)
height = max(1, height);
return IntRect(m_image->rect().x() * (m_image->hasRelativeWidth() ? 1.0f : multiplier), m_image->rect().y() * (m_image->hasRelativeHeight() ? 1.0f : multiplier), width, height);
int x = static_cast<int>(m_image->rect().x() * widthMultiplier);
int y = static_cast<int>(m_image->rect().y() * heightMultiplier);
return IntRect(x, y, width, height);
}
void CachedImage::notifyObservers()
......
......@@ -559,7 +559,7 @@ int DOMWindow::innerHeight() const
if (!view)
return 0;
return view->height() / m_frame->pageZoomFactor();
return static_cast<int>(view->height() / m_frame->pageZoomFactor());
}
int DOMWindow::innerWidth() const
......@@ -571,7 +571,7 @@ int DOMWindow::innerWidth() const
if (!view)
return 0;
return view->width() / m_frame->pageZoomFactor();
return static_cast<int>(view->width() / m_frame->pageZoomFactor());
}
int DOMWindow::screenX() const
......@@ -612,7 +612,7 @@ int DOMWindow::scrollX() const
if (doc)
doc->updateLayoutIgnorePendingStylesheets();
return view->contentsX() / m_frame->pageZoomFactor();
return static_cast<int>(view->contentsX() / m_frame->pageZoomFactor());
}
int DOMWindow::scrollY() const
......@@ -629,7 +629,7 @@ int DOMWindow::scrollY() const
if (doc)
doc->updateLayoutIgnorePendingStylesheets();
return view->contentsY() / m_frame->pageZoomFactor();
return static_cast<int>(view->contentsY() / m_frame->pageZoomFactor());
}
bool DOMWindow::closed() const
......@@ -828,7 +828,9 @@ void DOMWindow::scrollTo(int x, int y) const
if (!view)
return;
view->setContentsPos(x * m_frame->pageZoomFactor(), y * m_frame->pageZoomFactor());
int zoomedX = static_cast<int>(x * m_frame->pageZoomFactor());
int zoomedY = static_cast<int>(y * m_frame->pageZoomFactor());
view->setContentsPos(zoomedX, zoomedY);
}
void DOMWindow::moveBy(float x, float y) const
......
......@@ -94,18 +94,18 @@ const double autoscrollInterval = 0.05;
static Frame* subframeForTargetNode(Node* node);
static inline void scrollAndAcceptEvent(int delta, ScrollDirection positiveDirection, ScrollDirection negativeDirection, bool pageScrollEnabled, PlatformWheelEvent& e, Node* node, float windowHeightOrWidth)
static inline void scrollAndAcceptEvent(float delta, ScrollDirection positiveDirection, ScrollDirection negativeDirection, bool pageScrollEnabled, PlatformWheelEvent& e, Node* node, float windowHeightOrWidth)
{
if (!delta)
return;
int pixelsToScroll = abs(delta);
int pixelsToScroll = abs(static_cast<int>(delta));
if (!e.isContinuous() && !pageScrollEnabled) {
if (node->renderer()->scroll(delta < 0 ? negativeDirection : positiveDirection, ScrollByLine, pixelsToScroll))
e.accept();
} else {
if (pageScrollEnabled)
pixelsToScroll = windowHeightOrWidth;
pixelsToScroll = static_cast<int>(windowHeightOrWidth);
if (node->renderer()->scroll(delta < 0 ? negativeDirection : positiveDirection, ScrollByPixel, pixelsToScroll))
e.accept();
}
......
......@@ -174,4 +174,4 @@ void NPN_PopPopupsEnabledState(NPP instance)
void NPN_PluginThreadAsyncCall(NPP instance, void (*func) (void *), void *userData)
{
PluginMainThreadScheduler::scheduler().scheduleCall(instance, func, userData);
}
\ No newline at end of file
}
......@@ -96,7 +96,9 @@ void RenderReplaced::layout()
void RenderReplaced::intrinsicSizeChanged()
{
m_intrinsicSize = IntSize(cDefaultWidth * style()->effectiveZoom(), cDefaultHeight * style()->effectiveZoom());
int scaledWidth = static_cast<int>(cDefaultWidth * style()->effectiveZoom());
int scaledHeight = static_cast<int>(cDefaultHeight * style()->effectiveZoom());
m_intrinsicSize = IntSize(scaledWidth, scaledHeight);
setNeedsLayoutAndPrefWidthsRecalc();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment