Created
June 3, 2011 08:57
-
-
Save kkristof/1006076 to your computer and use it in GitHub Desktop.
testRepaint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp | |
index 001d55b..d8e7291 100644 | |
--- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp | |
+++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp | |
@@ -954,7 +954,22 @@ void DumpRenderTree::dump() | |
QImage image(m_page->viewportSize(), QImage::Format_ARGB32); | |
image.fill(Qt::white); | |
QPainter painter(&image); | |
- mainFrame->render(&painter); | |
+ if (m_controller->shouldTestRepaint()) { | |
+ int width = m_page->viewportSize().width(); | |
+ int height = m_page->viewportSize().height(); | |
+ if (m_controller->shouldSweepHorizontally()) { | |
+ for (QRect column(QPoint(0, 0), QSize(1, height)); column.x() < width; column.moveRight(column.x()+1)) { | |
+ painter.setClipRect(column); | |
+ mainFrame->render(&painter); | |
+ } | |
+ } else { | |
+ for (QRect line(QPoint(0, 0), QSize(width, 1)); line.y() < height; line.moveBottom(line.y()+1)) { | |
+ painter.setClipRect(line); | |
+ mainFrame->render(&painter); | |
+ } | |
+ } | |
+ } else | |
+ mainFrame->render(&painter); | |
painter.end(); | |
QCryptographicHash hash(QCryptographicHash::Md5); | |
diff --git a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp | |
index ff3ed33..87b8b6e 100644 | |
--- a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp | |
+++ b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp | |
@@ -72,6 +72,8 @@ void LayoutTestController::reset() | |
m_isGeolocationPermissionSet = false; | |
m_isPrinting = false; | |
m_geolocationPermission = false; | |
+ m_testRepaint = false; | |
+ m_sweepHorizontally = false; | |
DumpRenderTreeSupportQt::dumpEditingCallbacks(false); | |
DumpRenderTreeSupportQt::dumpFrameLoader(false); | |
@@ -224,6 +226,16 @@ void LayoutTestController::display() | |
emit showPage(); | |
} | |
+void LayoutTestController::testRepaint() | |
+{ | |
+ m_testRepaint = true; | |
+} | |
+ | |
+void LayoutTestController::repaintSweepHorizontally() | |
+{ | |
+ m_sweepHorizontally = true; | |
+} | |
+ | |
void LayoutTestController::displayInvalidatedRegion() | |
{ | |
display(); | |
diff --git a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h | |
index 99d04f3..25e6f35 100644 | |
--- a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h | |
+++ b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h | |
@@ -73,6 +73,8 @@ public: | |
bool waitForPolicy() const { return m_waitForPolicy; } | |
bool ignoreReqestForPermission() const { return m_ignoreDesktopNotification; } | |
bool isPrinting() { return m_isPrinting; } | |
+ bool shouldTestRepaint() { return m_testRepaint; } | |
+ bool shouldSweepHorizontally() { return m_sweepHorizontally; } | |
void reset(); | |
@@ -133,6 +135,8 @@ public slots: | |
bool checkDesktopNotificationPermission(const QString& origin); | |
void simulateDesktopNotificationClick(const QString& title); | |
void display(); | |
+ void testRepaint(); | |
+ void repaintSweepHorizontally(); | |
void displayInvalidatedRegion(); | |
void clearBackForwardList(); | |
QString pathToLocalResource(const QString& url); | |
@@ -301,6 +305,8 @@ private: | |
bool m_isGeolocationPermissionSet; | |
bool m_isPrinting; | |
bool m_geolocationPermission; | |
+ bool m_testRepaint; | |
+ bool m_sweepHorizontally; | |
QUrl m_userStyleSheetLocation; | |
QBasicTimer m_timeoutTimer; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment