Changeset 79884 in webkit
- Timestamp:
- Feb 28, 2011 11:08:22 AM (13 years ago)
- Location:
- trunk/Source/WebKit/qt
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/qt/Api/qwebelement.cpp
r78686 r79884 1488 1488 void QWebElement::render(QPainter* painter) 1489 1489 { 1490 render(painter, QRect()); 1491 } 1492 1493 /*! 1494 Render the element into \a painter clipping to \a clip. 1495 */ 1496 void QWebElement::render(QPainter* painter, const QRect& clip) 1497 { 1490 1498 WebCore::Element* e = m_element; 1491 1499 Document* doc = e ? e->document() : 0; … … 1506 1514 return; 1507 1515 1516 QRect finalClipRect = rect; 1517 if (!clip.isEmpty()) 1518 rect.intersect(clip.translated(rect.location())); 1519 1508 1520 GraphicsContext context(painter); 1509 1521 1510 1522 context.save(); 1511 1523 context.translate(-rect.x(), -rect.y()); 1524 painter->setClipRect(finalClipRect, Qt::IntersectClip); 1512 1525 view->setNodeToDraw(e); 1513 view->paintContents(&context, rect);1526 view->paintContents(&context, finalClipRect); 1514 1527 view->setNodeToDraw(0); 1515 1528 context.restore(); -
trunk/Source/WebKit/qt/Api/qwebelement.h
r67301 r79884 157 157 158 158 void render(QPainter* painter); 159 void render(QPainter* painter, const QRect& clipRect); 159 160 160 161 private: -
trunk/Source/WebKit/qt/ChangeLog
r79848 r79884 1 2011-02-28 Viatcheslav Ostapenko <ostapenko.viatcheslav@nokia.com> 2 3 Reviewed by Andreas Kling. 4 5 [Qt] Add clipped version of QWebElement::render method. 6 Allows faster rendering of web element part. 7 https://bugs.webkit.org/show_bug.cgi?id=50311 8 9 * Api/qwebelement.cpp: 10 (QWebElement::render): 11 * Api/qwebelement.h: 12 * tests/qwebelement/tst_qwebelement.cpp: 13 (tst_QWebElement::render): 14 1 15 2011-02-28 Kristian Amlie <kristian.amlie@nokia.com> 2 16 -
trunk/Source/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
r72510 r79884 940 940 QString html( "<html>" 941 941 "<head><style>" 942 "body, iframe { margin: 0px; border: none; }"942 "body, iframe { margin: 0px; border: none; background: white; }" 943 943 "</style></head>" 944 944 "<body><table width='300px' height='300px' border='1'>" … … 1013 1013 1014 1014 QVERIFY(image3 == image4); 1015 1016 // Chunked render test reuses page rendered in image4 in previous test 1017 const int chunkHeight = tableRect.height(); 1018 const int chunkWidth = tableRect.width() / 3; 1019 QImage chunk(chunkWidth, chunkHeight, QImage::Format_ARGB32); 1020 QRect chunkRect(0, 0, chunkWidth, chunkHeight); 1021 for (int x = 0; x < tableRect.width(); x += chunkWidth) { 1022 QPainter painter(&chunk); 1023 painter.fillRect(chunkRect, Qt::white); 1024 QRect chunkPaintRect(x, 0, chunkWidth, chunkHeight); 1025 tables[0].render(&painter, chunkPaintRect); 1026 painter.end(); 1027 1028 QVERIFY(chunk == image4.copy(chunkPaintRect)); 1029 } 1015 1030 } 1016 1031
Note: See TracChangeset
for help on using the changeset viewer.