Changeset 37146 in webkit
- Timestamp:
- Oct 1, 2008 10:51:02 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/dom/Document.cpp
r37113 r37146 1109 1109 { 1110 1110 // we should not enter style recalc while painting 1111 if (frame() && frame()-> isPainting()) {1112 ASSERT(!frame()-> isPainting());1111 if (frame() && frame()->view() && frame()->view()->isPainting()) { 1112 ASSERT(!frame()->view()->isPainting()); 1113 1113 return; 1114 1114 } -
trunk/WebCore/loader/Cache.cpp
r36321 r37146 31 31 #include "DocLoader.h" 32 32 #include "Document.h" 33 #include "Frame.h"34 33 #include "FrameLoader.h" 34 #include "FrameView.h" 35 35 #include "Image.h" 36 36 #include "ResourceHandle.h" … … 270 270 271 271 unsigned targetSize = static_cast<unsigned>(capacity * cTargetPrunePercentage); // Cut by a percentage to avoid immediately pruning again. 272 double currentTime = Frame ::currentPaintTimeStamp();272 double currentTime = FrameView::currentPaintTimeStamp(); 273 273 if (!currentTime) // In case prune is called directly, outside of a Frame paint. 274 274 currentTime = WebCore::currentTime(); -
trunk/WebCore/loader/CachedImage.cpp
r36096 r37146 30 30 #include "CachedResourceClientWalker.h" 31 31 #include "DocLoader.h" 32 #include "Frame .h"32 #include "FrameView.h" 33 33 #include "Request.h" 34 34 #include "SystemTime.h" … … 302 302 return; 303 303 304 double timeStamp = Frame ::currentPaintTimeStamp();304 double timeStamp = FrameView::currentPaintTimeStamp(); 305 305 if (!timeStamp) // If didDraw is called outside of a Frame paint. 306 306 timeStamp = currentTime(); -
trunk/WebCore/page/Frame.cpp
r37112 r37146 96 96 using namespace HTMLNames; 97 97 98 double Frame::s_currentPaintTimeStamp = 0.0;99 100 98 #ifndef NDEBUG 101 99 static WTF::RefCountedLeakCounter frameCounter("Frame"); … … 1240 1238 } 1241 1239 1242 // FIXME: why is this here instead of on the FrameView?1243 void Frame::paint(GraphicsContext* p, const IntRect& rect)1244 {1245 #ifndef NDEBUG1246 bool fillWithRed;1247 if (!document() || document()->printing())1248 fillWithRed = false; // Printing, don't fill with red (can't remember why).1249 else if (document()->ownerElement())1250 fillWithRed = false; // Subframe, don't fill with red.1251 else if (view() && view()->isTransparent())1252 fillWithRed = false; // Transparent, don't fill with red.1253 else if (d->m_paintRestriction == PaintRestrictionSelectionOnly || d->m_paintRestriction == PaintRestrictionSelectionOnlyBlackText)1254 fillWithRed = false; // Selections are transparent, don't fill with red.1255 else if (d->m_elementToDraw)1256 fillWithRed = false; // Element images are transparent, don't fill with red.1257 else1258 fillWithRed = true;1259 1260 if (fillWithRed)1261 p->fillRect(rect, Color(0xFF, 0, 0));1262 #endif1263 1264 bool isTopLevelPainter = !s_currentPaintTimeStamp;1265 if (isTopLevelPainter)1266 s_currentPaintTimeStamp = currentTime();1267 1268 if (contentRenderer()) {1269 ASSERT(d->m_view && !d->m_view->needsLayout());1270 ASSERT(!d->m_isPainting);1271 1272 d->m_isPainting = true;1273 1274 // d->m_elementToDraw is used to draw only one element1275 RenderObject* eltRenderer = d->m_elementToDraw ? d->m_elementToDraw->renderer() : 0;1276 if (d->m_paintRestriction == PaintRestrictionNone)1277 document()->invalidateRenderedRectsForMarkersInRect(rect);1278 contentRenderer()->layer()->paint(p, rect, d->m_paintRestriction, eltRenderer);1279 1280 d->m_isPainting = false;1281 1282 #if ENABLE(DASHBOARD_SUPPORT)1283 // Regions may have changed as a result of the visibility/z-index of element changing.1284 if (document()->dashboardRegionsDirty())1285 view()->updateDashboardRegions();1286 #endif1287 } else1288 LOG_ERROR("called Frame::paint with nil renderer");1289 1290 if (isTopLevelPainter)1291 s_currentPaintTimeStamp = 0;1292 }1293 1294 void Frame::setPaintRestriction(PaintRestriction pr)1295 {1296 d->m_paintRestriction = pr;1297 }1298 1299 bool Frame::isPainting() const1300 {1301 return d->m_isPainting;1302 }1303 1304 1240 void Frame::adjustPageHeight(float *newBottom, float oldTop, float oldBottom, float bottomLimit) 1305 1241 { … … 1623 1559 GraphicsContext context((PlatformGraphicsContext*)0); 1624 1560 context.setPaintingDisabled(true); 1625 paint(&context, visibleRect);1561 d->m_view->paintContents(&context, visibleRect); 1626 1562 } 1627 1563 } … … 1875 1811 , m_animationController(thisFrame) 1876 1812 , m_lifeSupportTimer(thisFrame, &Frame::lifeSupportTimerFired) 1877 , m_paintRestriction(PaintRestrictionNone)1878 1813 , m_caretVisible(false) 1879 1814 , m_caretPaint(true) 1880 , m_isPainting(false)1881 1815 , m_highlightTextMatches(false) 1882 1816 , m_inViewSourceMode(false) -
trunk/WebCore/page/Frame.h
r37112 r37146 164 164 // === to be moved into FrameView 165 165 166 public: 167 void paint(GraphicsContext*, const IntRect&); 168 void setPaintRestriction(PaintRestriction); 169 bool isPainting() const; 170 171 static double currentPaintTimeStamp() { return s_currentPaintTimeStamp; } // returns 0 if not painting 172 166 public: 173 167 void forceLayout(bool allowSubtree = false); 174 168 void forceLayoutWithPageWidthRange(float minPageWidth, float maxPageWidth, bool adjustViewSize); … … 187 181 void setProhibitsScrolling(const bool); 188 182 189 private:190 static double s_currentPaintTimeStamp; // used for detecting decoded resource thrash in the cache191 192 183 // === to be moved into Chrome 193 184 -
trunk/WebCore/page/FramePrivate.h
r37112 r37146 82 82 Timer<Frame> m_lifeSupportTimer; 83 83 84 RefPtr<Node> m_elementToDraw;85 PaintRestriction m_paintRestriction;86 87 84 bool m_caretVisible; 88 85 bool m_caretPaint; 89 bool m_isPainting; 90 86 91 87 bool m_highlightTextMatches; 92 88 bool m_inViewSourceMode; -
trunk/WebCore/page/FrameView.cpp
r37105 r37146 46 46 #include "RenderView.h" 47 47 #include "Settings.h" 48 #include "SystemTime.h" 48 49 49 50 namespace WebCore { 50 51 51 52 using namespace HTMLNames; 53 54 double FrameView::sCurrentPaintTimeStamp = 0.0; 52 55 53 56 struct ScheduledEvent { … … 101 104 m_repaintRect = IntRect(); 102 105 m_repaintRects.clear(); 106 m_paintRestriction = PaintRestrictionNone; 107 m_isPainting = false; 103 108 } 104 109 … … 149 154 150 155 bool m_shouldUpdateWhileOffscreen; 156 157 RefPtr<Node> m_nodeToDraw; 158 PaintRestriction m_paintRestriction; 159 bool m_isPainting; 151 160 }; 152 161 … … 350 359 351 360 // we shouldn't enter layout() while painting 352 ASSERT(! m_frame->isPainting());353 if ( m_frame->isPainting())361 ASSERT(!isPainting()); 362 if (isPainting()) 354 363 return; 355 364 … … 1050 1059 GraphicsContext context(noContext); 1051 1060 context.setUpdatingControlTints(true); 1052 #if !PLATFORM(MAC) 1053 ScrollView::paint(&context, frameRect()); 1054 #else 1055 m_frame->paint(&context, visibleContentRect()); 1061 if (platformWidget()) 1062 paintContents(&context, visibleContentRect()); 1063 else 1064 paint(&context, frameRect()); 1065 } 1066 } 1067 1068 bool FrameView::wasScrolledByUser() const 1069 { 1070 return d->m_wasScrolledByUser; 1071 } 1072 1073 void FrameView::setWasScrolledByUser(bool wasScrolledByUser) 1074 { 1075 if (d->m_inProgrammaticScroll) 1076 return; 1077 d->m_wasScrolledByUser = wasScrolledByUser; 1078 } 1079 1080 void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) 1081 { 1082 if (!frame()) 1083 return; 1084 1085 Document* document = frame()->document(); 1086 if (!document) 1087 return; 1088 1089 #ifndef NDEBUG 1090 bool fillWithRed; 1091 if (document || document->printing()) 1092 fillWithRed = false; // Printing, don't fill with red (can't remember why). 1093 else if (document->ownerElement()) 1094 fillWithRed = false; // Subframe, don't fill with red. 1095 else if (isTransparent()) 1096 fillWithRed = false; // Transparent, don't fill with red. 1097 else if (d->m_paintRestriction == PaintRestrictionSelectionOnly || d->m_paintRestriction == PaintRestrictionSelectionOnlyBlackText) 1098 fillWithRed = false; // Selections are transparent, don't fill with red. 1099 else if (d->m_nodeToDraw) 1100 fillWithRed = false; // Element images are transparent, don't fill with red. 1101 else 1102 fillWithRed = true; 1103 1104 if (fillWithRed) 1105 p->fillRect(rect, Color(0xFF, 0, 0)); 1056 1106 #endif 1057 } 1058 } 1059 1060 bool FrameView::wasScrolledByUser() const 1061 { 1062 return d->m_wasScrolledByUser; 1063 } 1064 1065 void FrameView::setWasScrolledByUser(bool wasScrolledByUser) 1066 { 1067 if (d->m_inProgrammaticScroll) 1068 return; 1069 d->m_wasScrolledByUser = wasScrolledByUser; 1107 1108 bool isTopLevelPainter = !sCurrentPaintTimeStamp; 1109 if (isTopLevelPainter) 1110 sCurrentPaintTimeStamp = currentTime(); 1111 1112 RenderView* contentRenderer = frame()->contentRenderer(); 1113 if (!contentRenderer) { 1114 LOG_ERROR("called Frame::paint with nil renderer"); 1115 return; 1116 } 1117 1118 ASSERT(!needsLayout()); 1119 ASSERT(!d->m_isPainting); 1120 1121 d->m_isPainting = true; 1122 1123 // m_nodeToDraw is used to draw only one element (and its descendants) 1124 RenderObject* eltRenderer = d->m_nodeToDraw ? d->m_nodeToDraw->renderer() : 0; 1125 if (d->m_paintRestriction == PaintRestrictionNone) 1126 document->invalidateRenderedRectsForMarkersInRect(rect); 1127 contentRenderer->layer()->paint(p, rect, d->m_paintRestriction, eltRenderer); 1128 1129 d->m_isPainting = false; 1130 1131 #if ENABLE(DASHBOARD_SUPPORT) 1132 // Regions may have changed as a result of the visibility/z-index of element changing. 1133 if (document->dashboardRegionsDirty()) 1134 updateDashboardRegions(); 1135 #endif 1136 1137 if (isTopLevelPainter) 1138 sCurrentPaintTimeStamp = 0; 1139 } 1140 1141 void FrameView::setPaintRestriction(PaintRestriction pr) 1142 { 1143 d->m_paintRestriction = pr; 1144 } 1145 1146 bool FrameView::isPainting() const 1147 { 1148 return d->m_isPainting; 1149 } 1150 1151 void FrameView::setNodeToDraw(Node* node) 1152 { 1153 d->m_nodeToDraw = node; 1070 1154 } 1071 1155 -
trunk/WebCore/page/FrameView.h
r37105 r37146 26 26 #define FrameView_h 27 27 28 #include "IntSize.h" 29 #include "RenderLayer.h" 28 30 #include "ScrollView.h" 29 #include "IntSize.h"30 31 #include <wtf/Forward.h> 31 32 #include <wtf/OwnPtr.h> … … 94 95 95 96 bool needsFullRepaint() const; 96 97 97 98 void resetScrollbars(); 98 99 … … 149 150 void removeWidgetToUpdate(RenderPartObject*); 150 151 152 virtual void paintContents(GraphicsContext*, const IntRect& damageRect); 153 void setPaintRestriction(PaintRestriction); 154 bool isPainting() const; 155 void setNodeToDraw(Node*); 156 157 static double currentPaintTimeStamp() { return sCurrentPaintTimeStamp; } // returns 0 if not painting 158 151 159 // FIXME: This function should be used by all platforms, but currently depends on ScrollView::children, 152 160 // which not all platforms have. Once FrameView and ScrollView are merged, this #if should be removed. … … 171 179 virtual void repaintContentRectangle(const IntRect&, bool immediate); 172 180 181 static double sCurrentPaintTimeStamp; // used for detecting decoded resource thrash in the cache 182 173 183 unsigned m_refCount; 174 184 IntSize m_size; -
trunk/WebCore/page/mac/FrameMac.mm
r37061 r37146 317 317 NSImage* Frame::selectionImage(bool forceBlackText) const 318 318 { 319 d->m_ paintRestriction = forceBlackText ? PaintRestrictionSelectionOnlyBlackText : PaintRestrictionSelectionOnly;319 d->m_view->setPaintRestriction(forceBlackText ? PaintRestrictionSelectionOnlyBlackText : PaintRestrictionSelectionOnly); 320 320 d->m_doc->updateLayout(); 321 321 NSImage* result = imageFromRect(selectionRect()); 322 d->m_ paintRestriction = PaintRestrictionNone;322 d->m_view->setPaintRestriction(PaintRestrictionNone); 323 323 return result; 324 324 } … … 336 336 NSRect paintingRect = renderer->paintingRootRect(topLevelRect); 337 337 338 d->m_ elementToDraw = node; // invoke special sub-tree drawing mode338 d->m_view->setNodeToDraw(node); // invoke special sub-tree drawing mode 339 339 NSImage* result = imageFromRect(paintingRect); 340 340 renderer->updateDragState(false); 341 341 d->m_doc->updateLayout(); 342 d->m_ elementToDraw = 0;342 d->m_view->setNodeToDraw(0); 343 343 344 344 if (elementRect) … … 360 360 NSRect paintingRect = renderer->paintingRootRect(topLevelRect); 361 361 362 d->m_ elementToDraw = node; // invoke special sub-tree drawing mode362 d->m_view->setNodeToDraw(node); // invoke special sub-tree drawing mode 363 363 NSImage* result = imageFromRect(paintingRect); 364 d->m_ elementToDraw = 0;364 d->m_view->setNodeToDraw(0); 365 365 366 366 return result; -
trunk/WebCore/page/win/FrameCGWin.cpp
r30674 r37146 52 52 HBITMAP imageFromSelection(Frame* frame, bool forceBlackText) 53 53 { 54 frame-> setPaintRestriction(forceBlackText ? PaintRestrictionSelectionOnlyBlackText : PaintRestrictionSelectionOnly);54 frame->view()->setPaintRestriction(forceBlackText ? PaintRestrictionSelectionOnlyBlackText : PaintRestrictionSelectionOnly); 55 55 FloatRect fr = frame->selectionRect(); 56 56 IntRect ir(static_cast<int>(fr.x()), static_cast<int>(fr.y()), … … 80 80 DeleteDC(hdc); 81 81 82 frame-> setPaintRestriction(PaintRestrictionNone);82 frame->view()->setPaintRestriction(PaintRestrictionNone); 83 83 84 84 return hbmp; -
trunk/WebCore/platform/ScrollView.cpp
r37127 r37146 27 27 #include "ScrollView.h" 28 28 29 #include "GraphicsContext.h" 29 30 #include "HostWindow.h" 30 31 #include "PlatformMouseEvent.h" 31 32 #include "PlatformWheelEvent.h" 32 33 #include "Scrollbar.h" 34 #include "ScrollbarTheme.h" 33 35 34 36 using std::max; … … 44 46 m_scrollbarsAvoidingResizer = 0; 45 47 m_scrollbarsSuppressed = false; 48 m_drawPanScrollIcon = false; 46 49 } 47 50 … … 355 358 } 356 359 360 void ScrollView::paint(GraphicsContext* context, const IntRect& rect) 361 { 362 if (platformWidget()) { 363 Widget::paint(context, rect); 364 return; 365 } 366 367 if (context->paintingDisabled() && !context->updatingControlTints()) 368 return; 369 370 IntRect documentDirtyRect = rect; 371 documentDirtyRect.intersect(frameRect()); 372 373 context->save(); 374 375 context->translate(x(), y()); 376 documentDirtyRect.move(-x(), -y()); 377 378 context->translate(-scrollX(), -scrollY()); 379 documentDirtyRect.move(scrollX(), scrollY()); 380 381 context->clip(visibleContentRect()); 382 383 paintContents(context, documentDirtyRect); 384 385 context->restore(); 386 387 // Now paint the scrollbars. 388 if (!m_scrollbarsSuppressed && (m_horizontalScrollbar || m_verticalScrollbar)) { 389 context->save(); 390 IntRect scrollViewDirtyRect = rect; 391 scrollViewDirtyRect.intersect(frameRect()); 392 context->translate(x(), y()); 393 scrollViewDirtyRect.move(-x(), -y()); 394 if (m_horizontalScrollbar) 395 m_horizontalScrollbar->paint(context, scrollViewDirtyRect); 396 if (m_verticalScrollbar) 397 m_verticalScrollbar->paint(context, scrollViewDirtyRect); 398 399 IntRect hCorner; 400 if (m_horizontalScrollbar && width() - m_horizontalScrollbar->width() > 0) { 401 hCorner = IntRect(m_horizontalScrollbar->width(), 402 height() - m_horizontalScrollbar->height(), 403 width() - m_horizontalScrollbar->width(), 404 m_horizontalScrollbar->height()); 405 if (hCorner.intersects(scrollViewDirtyRect)) 406 ScrollbarTheme::nativeTheme()->paintScrollCorner(this, context, hCorner); 407 } 408 409 if (m_verticalScrollbar && height() - m_verticalScrollbar->height() > 0) { 410 IntRect vCorner(width() - m_verticalScrollbar->width(), 411 m_verticalScrollbar->height(), 412 m_verticalScrollbar->width(), 413 height() - m_verticalScrollbar->height()); 414 if (vCorner != hCorner && vCorner.intersects(scrollViewDirtyRect)) 415 ScrollbarTheme::nativeTheme()->paintScrollCorner(this, context, vCorner); 416 } 417 418 context->restore(); 419 } 420 421 // Paint the panScroll Icon 422 static RefPtr<Image> panScrollIcon; 423 if (m_drawPanScrollIcon) { 424 if (!panScrollIcon) 425 panScrollIcon = Image::loadPlatformResource("panIcon"); 426 context->drawImage(panScrollIcon.get(), m_panScrollIconPoint); 427 } 428 } 429 357 430 #if !PLATFORM(MAC) 358 431 void ScrollView::platformSetCanBlitOnScroll() -
trunk/WebCore/platform/ScrollView.h
r37113 r37146 185 185 #endif 186 186 187 virtual void paint(GraphicsContext*, const IntRect&); 188 187 189 protected: 188 190 virtual void repaintContentRectangle(const IntRect&, bool now = false); 191 virtual void paintContents(GraphicsContext*, const IntRect& damageRect) = 0; 192 189 193 void updateWindowRect(const IntRect&, bool now = false); 190 194 … … 202 206 int m_scrollbarsAvoidingResizer; 203 207 bool m_scrollbarsSuppressed; 208 209 IntPoint m_panScrollIconPoint; 210 bool m_drawPanScrollIcon; 204 211 205 212 void init(); … … 236 243 #if !PLATFORM(MAC) && !PLATFORM(WX) 237 244 public: 238 virtual void paint(GraphicsContext*, const IntRect&);239 240 245 virtual void setFrameRect(const IntRect&); 241 246 -
trunk/WebCore/platform/ScrollbarTheme.h
r37118 r37146 27 27 #define ScrollbarTheme_h 28 28 29 #include "GraphicsContext.h" 29 30 #include "IntRect.h" 30 31 #include "ScrollTypes.h" … … 32 33 namespace WebCore { 33 34 34 class GraphicsContext;35 35 class PlatformMouseEvent; 36 36 class Scrollbar; 37 class ScrollView; 37 38 38 39 class ScrollbarTheme { … … 40 41 virtual ~ScrollbarTheme() {}; 41 42 42 virtual bool paint(Scrollbar*, GraphicsContext* context, const IntRect& damageRect) { return false; }43 virtual bool paint(Scrollbar*, GraphicsContext*, const IntRect& damageRect) { return false; } 43 44 virtual ScrollbarPart hitTest(Scrollbar*, const PlatformMouseEvent&) { return NoPart; } 44 45 … … 73 74 virtual void invalidatePart(Scrollbar*, ScrollbarPart) {} 74 75 76 virtual void paintScrollCorner(ScrollView*, GraphicsContext* context, const IntRect& cornerRect) { context->fillRect(cornerRect, Color::white); } 77 75 78 virtual bool shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent&) { return false; } 76 79 virtual int thumbPosition(Scrollbar*) { return 0; } // The position of the thumb relative to the track. -
trunk/WebCore/platform/ScrollbarThemeComposite.cpp
r37118 r37146 282 282 } 283 283 284 } 284 void ScrollbarThemeComposite::paintScrollCorner(ScrollView* view, GraphicsContext* context, const IntRect& cornerRect) 285 { 286 FrameView* frameView = static_cast<FrameView*>(view); 287 Page* page = frameView->frame() ? frameView->frame()->page() : 0; 288 if (page && page->settings()->shouldPaintCustomScrollbars()) { 289 if (!page->chrome()->client()->paintCustomScrollCorner(context, cornerRect)) 290 context->fillRect(cornerRect, Color::white); 291 } 292 } 293 294 } -
trunk/WebCore/platform/ScrollbarThemeComposite.h
r37118 r37146 44 44 virtual int trackLength(Scrollbar*); 45 45 46 virtual void paintScrollCorner(ScrollView*, GraphicsContext*, const IntRect& cornerRect); 47 46 48 protected: 47 49 virtual bool hasButtons(Scrollbar*) = 0; -
trunk/WebCore/platform/gtk/ScrollViewGtk.cpp
r37113 r37146 466 466 } 467 467 468 void ScrollView::paint(GraphicsContext* context, const IntRect& rect)469 {470 // FIXME: This code is here so we don't have to fork FrameView.h/.cpp.471 // In the end, FrameView should just merge with ScrollView.472 ASSERT(isFrameView());473 474 if (context->paintingDisabled())475 return;476 477 IntRect documentDirtyRect = rect;478 documentDirtyRect.intersect(frameRect());479 480 context->save();481 482 context->translate(x(), y());483 documentDirtyRect.move(-x(), -y());484 485 context->translate(-scrollX(), -scrollY());486 documentDirtyRect.move(scrollX(), scrollY());487 488 context->clip(enclosingIntRect(visibleContentRect()));489 static_cast<const FrameView*>(this)->frame()->paint(context, documentDirtyRect);490 context->restore();491 492 // Now paint the scrollbars.493 if (!m_scrollbarsSuppressed && (m_horizontalScrollbar || m_verticalScrollbar)) {494 context->save();495 IntRect scrollViewDirtyRect = rect;496 scrollViewDirtyRect.intersect(frameRect());497 context->translate(x(), y());498 scrollViewDirtyRect.move(-x(), -y());499 if (m_horizontalScrollbar)500 m_horizontalScrollbar->paint(context, scrollViewDirtyRect);501 if (m_verticalScrollbar)502 m_verticalScrollbar->paint(context, scrollViewDirtyRect);503 504 /*505 * FIXME: TODO: Check if that works with RTL506 */507 // Fill the scroll corner with white.508 IntRect hCorner;509 if (m_horizontalScrollbar && width() - m_horizontalScrollbar->width() > 0) {510 hCorner = IntRect(m_horizontalScrollbar->width(),511 height() - m_horizontalScrollbar->height(),512 width() - m_horizontalScrollbar->width(),513 m_horizontalScrollbar->height());514 if (hCorner.intersects(scrollViewDirtyRect))515 context->fillRect(hCorner, Color::white);516 }517 518 if (m_verticalScrollbar && height() - m_verticalScrollbar->height() > 0) {519 IntRect vCorner(width() - m_verticalScrollbar->width(),520 m_verticalScrollbar->height(),521 m_verticalScrollbar->width(),522 height() - m_verticalScrollbar->height());523 if (vCorner != hCorner && vCorner.intersects(scrollViewDirtyRect))524 context->fillRect(vCorner, Color::white);525 }526 527 context->restore();528 }529 }530 531 468 void ScrollView::addToDirtyRegion(const IntRect& containingWindowRect) 532 469 { -
trunk/WebCore/platform/qt/ScrollViewQt.cpp
r37113 r37146 360 360 } 361 361 362 static void drawScrollbarCorner(GraphicsContext* context, const IntRect& rect)363 {364 #if QT_VERSION < 0x040500365 context->fillRect(rect, QApplication::palette().color(QPalette::Normal, QPalette::Window));366 #else367 QStyleOption option;368 option.rect = rect;369 QApplication::style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner,370 &option, context->platformContext(), 0);371 #endif372 }373 374 375 void ScrollView::paint(GraphicsContext* context, const IntRect& rect)376 {377 // FIXME: This code is here so we don't have to fork FrameView.h/.cpp.378 // In the end, FrameView should just merge with ScrollView.379 ASSERT(isFrameView());380 381 if (context->paintingDisabled())382 return;383 384 IntRect documentDirtyRect = rect;385 386 context->save();387 388 context->translate(x(), y());389 documentDirtyRect.move(-x(), -y());390 391 context->translate(-scrollX(), -scrollY());392 documentDirtyRect.move(scrollX(), scrollY());393 394 documentDirtyRect.intersect(enclosingIntRect(visibleContentRect()));395 context->clip(documentDirtyRect);396 397 static_cast<const FrameView*>(this)->frame()->paint(context, documentDirtyRect);398 399 context->restore();400 401 // Now paint the scrollbars.402 if (!m_scrollbarsSuppressed && (m_horizontalScrollbar || m_verticalScrollbar)) {403 context->save();404 IntRect scrollViewDirtyRect = rect;405 scrollViewDirtyRect.intersect(frameRect());406 context->translate(x(), y());407 scrollViewDirtyRect.move(-x(), -y());408 if (m_horizontalScrollbar)409 m_horizontalScrollbar->paint(context, scrollViewDirtyRect);410 if (m_verticalScrollbar)411 m_verticalScrollbar->paint(context, scrollViewDirtyRect);412 413 // Fill the scroll corners using the current Qt style414 IntRect hCorner;415 if (m_horizontalScrollbar && width() - m_horizontalScrollbar->width() > 0) {416 hCorner = IntRect(m_horizontalScrollbar->width(),417 height() - m_horizontalScrollbar->height(),418 width() - m_horizontalScrollbar->width(),419 m_horizontalScrollbar->height());420 if (hCorner.intersects(scrollViewDirtyRect))421 drawScrollbarCorner(context, hCorner);422 }423 424 if (m_verticalScrollbar && height() - m_verticalScrollbar->height() > 0) {425 IntRect vCorner(width() - m_verticalScrollbar->width(),426 m_verticalScrollbar->height(),427 m_verticalScrollbar->width(),428 height() - m_verticalScrollbar->height());429 if (vCorner != hCorner && vCorner.intersects(scrollViewDirtyRect))430 drawScrollbarCorner(context, vCorner);431 }432 433 context->restore();434 }435 }436 437 362 void ScrollView::addToDirtyRegion(const IntRect& containingWindowRect) 438 363 { -
trunk/WebCore/platform/qt/ScrollbarThemeQt.cpp
r37118 r37146 211 211 } 212 212 213 } 214 213 void ScrollbarThemeQt::paintScrollbarCorner(ScrollView*, GraphicsContext* context, const IntRect& rect) 214 { 215 #if QT_VERSION < 0x040500 216 context->fillRect(rect, QApplication::palette().color(QPalette::Normal, QPalette::Window)); 217 #else 218 QStyleOption option; 219 option.rect = rect; 220 QApplication::style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner, 221 &option, context->platformContext(), 0); 222 #endif 223 } 224 225 } 226 -
trunk/WebCore/platform/qt/ScrollbarThemeQt.h
r37118 r37146 35 35 virtual ~ScrollbarThemeQt(); 36 36 37 virtual bool paint(Scrollbar*, GraphicsContext* context, const IntRect& damageRect); 37 virtual bool paint(Scrollbar*, GraphicsContext*, const IntRect& damageRect); 38 virtual void paintScrollCorner(ScrollView*, GraphicsContext*, const IntRect& cornerRect); 39 38 40 virtual ScrollbarPart hitTest(Scrollbar*, const PlatformMouseEvent&); 39 41 -
trunk/WebCore/platform/win/ScrollViewWin.cpp
r37113 r37146 60 60 : m_view(view) 61 61 , m_inUpdateScrollbars(false) 62 , m_panScrollIconPoint(0,0)63 , m_drawPanScrollIcon(false)64 62 { 65 63 } … … 84 82 bool m_inUpdateScrollbars; 85 83 HRGN m_dirtyRegion; 86 IntPoint m_panScrollIconPoint;87 bool m_drawPanScrollIcon;88 84 }; 89 85 … … 146 142 ::InvalidateRect(containingWindowHandle, &r, false); 147 143 148 if (m_ drawPanScrollIcon) {144 if (m_view->m_drawPanScrollIcon) { 149 145 int panIconDirtySquareSizeLength = 2 * (panIconSizeLength + max(abs(scrollDelta.width()), abs(scrollDelta.height()))); // We only want to repaint what's necessary 150 IntPoint panIconDirtySquareLocation = IntPoint(m_ panScrollIconPoint.x() - (panIconDirtySquareSizeLength / 2),m_panScrollIconPoint.y() - (panIconDirtySquareSizeLength / 2));146 IntPoint panIconDirtySquareLocation = IntPoint(m_view->m_panScrollIconPoint.x() - (panIconDirtySquareSizeLength / 2), m_view->m_panScrollIconPoint.y() - (panIconDirtySquareSizeLength / 2)); 151 147 IntRect panScrollIconDirtyRect = IntRect(panIconDirtySquareLocation , IntSize(panIconDirtySquareSizeLength, panIconDirtySquareSizeLength)); 152 148 … … 357 353 void ScrollView::printPanScrollIcon(const IntPoint& iconPosition) 358 354 { 359 m_d ata->m_drawPanScrollIcon = true;360 m_ data->m_panScrollIconPoint = IntPoint(iconPosition.x() - panIconSizeLength / 2 , iconPosition.y() - panIconSizeLength / 2) ;361 362 updateWindowRect(IntRect(m_ data->m_panScrollIconPoint, IntSize(panIconSizeLength,panIconSizeLength)), true);355 m_drawPanScrollIcon = true; 356 m_panScrollIconPoint = IntPoint(iconPosition.x() - panIconSizeLength / 2 , iconPosition.y() - panIconSizeLength / 2) ; 357 358 updateWindowRect(IntRect(m_panScrollIconPoint, IntSize(panIconSizeLength,panIconSizeLength)), true); 363 359 } 364 360 365 361 void ScrollView::removePanScrollIcon() 366 362 { 367 m_data->m_drawPanScrollIcon = false; 368 369 updateWindowRect(IntRect(m_data->m_panScrollIconPoint, IntSize(panIconSizeLength, panIconSizeLength)), true); 370 } 371 372 void ScrollView::paint(GraphicsContext* context, const IntRect& rect) 373 { 374 // FIXME: This code is here so we don't have to fork FrameView.h/.cpp. 375 // In the end, FrameView should just merge with ScrollView. 376 ASSERT(isFrameView()); 377 378 if (context->paintingDisabled() && !context->updatingControlTints()) 379 return; 380 381 IntRect documentDirtyRect = rect; 382 documentDirtyRect.intersect(frameRect()); 383 384 context->save(); 385 386 context->translate(x(), y()); 387 documentDirtyRect.move(-x(), -y()); 388 389 context->translate(-scrollX(), -scrollY()); 390 documentDirtyRect.move(scrollX(), scrollY()); 391 392 context->clip(visibleContentRect()); 393 394 const FrameView* frameView = static_cast<const FrameView*>(this); 395 frameView->frame()->paint(context, documentDirtyRect); 396 397 context->restore(); 398 399 // Now paint the scrollbars. 400 if (!m_scrollbarsSuppressed && (m_horizontalScrollbar || m_verticalScrollbar)) { 401 context->save(); 402 IntRect scrollViewDirtyRect = rect; 403 scrollViewDirtyRect.intersect(frameRect()); 404 context->translate(x(), y()); 405 scrollViewDirtyRect.move(-x(), -y()); 406 if (m_horizontalScrollbar) 407 m_horizontalScrollbar->paint(context, scrollViewDirtyRect); 408 if (m_verticalScrollbar) 409 m_verticalScrollbar->paint(context, scrollViewDirtyRect); 410 411 // Fill the scroll corner with white. 412 IntRect hCorner; 413 if (m_horizontalScrollbar && width() - m_horizontalScrollbar->width() > 0) { 414 hCorner = IntRect(m_horizontalScrollbar->width(), 415 height() - m_horizontalScrollbar->height(), 416 width() - m_horizontalScrollbar->width(), 417 m_horizontalScrollbar->height()); 418 if (hCorner.intersects(scrollViewDirtyRect)) { 419 Page* page = frameView->frame() ? frameView->frame()->page() : 0; 420 if (page && page->settings()->shouldPaintCustomScrollbars()) { 421 if (!page->chrome()->client()->paintCustomScrollCorner(context, hCorner)) 422 context->fillRect(hCorner, Color::white); 423 } 424 } 425 } 426 427 if (m_verticalScrollbar && height() - m_verticalScrollbar->height() > 0) { 428 IntRect vCorner(width() - m_verticalScrollbar->width(), 429 m_verticalScrollbar->height(), 430 m_verticalScrollbar->width(), 431 height() - m_verticalScrollbar->height()); 432 if (vCorner != hCorner && vCorner.intersects(scrollViewDirtyRect)) { 433 Page* page = frameView->frame() ? frameView->frame()->page() : 0; 434 if (page && page->settings()->shouldPaintCustomScrollbars()) { 435 if (!page->chrome()->client()->paintCustomScrollCorner(context, vCorner)) 436 context->fillRect(vCorner, Color::white); 437 } 438 } 439 } 440 441 context->restore(); 442 } 443 444 //Paint the panScroll Icon 445 static RefPtr<Image> panScrollIcon; 446 if (m_data->m_drawPanScrollIcon) { 447 if (!panScrollIcon) 448 panScrollIcon = Image::loadPlatformResource("panIcon"); 449 context->drawImage(panScrollIcon.get(), m_data->m_panScrollIconPoint); 450 } 363 m_drawPanScrollIcon = false; 364 365 updateWindowRect(IntRect(m_panScrollIconPoint, IntSize(panIconSizeLength, panIconSizeLength)), true); 451 366 } 452 367 -
trunk/WebCore/svg/graphics/SVGImage.cpp
r37112 r37146 154 154 if (m_frame->view()->needsLayout()) 155 155 m_frame->view()->layout(); 156 m_frame-> paint(context, enclosingIntRect(srcRect));156 m_frame->view()->paint(context, enclosingIntRect(srcRect)); 157 157 158 158 if (compositeOp != CompositeSourceOver) -
trunk/WebKit/mac/ChangeLog
r37131 r37146 1 2008-09-30 Dave Hyatt <hyatt@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=21269 4 5 This patch makes the ScrollView::paint method cross-platform. The paint method calls the base class 6 Widget paint on platforms with native widgets (Mac and wx). Otherwise it calls a virtual function, 7 paintContents, to paint the ScrollView's contents, and then it paints each of the two scrollbars and 8 the scrollbar corner. 9 10 The scrollbar themes are now responsible for painting scrollbar corners. At the moment ScrollbarThemeWin still 11 paints white (which is incorrect), so a future patch will actually implement proper native scroll corner painting 12 for Windows. 13 14 paintContents is implemented by FrameView, and replaces Frame::paint. All of the FramePrivate member 15 variables used by Frame::paint have moved to FrameViewPrivate instead. All callers of Frame::paint have 16 been patched to use FrameView::paintContents instead. 17 18 Reviewed by Darin Adler 19 20 * WebView/WebFrame.mm: 21 (-[WebFrame _drawRect:]): 22 1 23 2008-09-30 Kevin Decker <kdecker@apple.com> 2 24 -
trunk/WebKit/mac/WebView/WebFrame.mm
r36553 r37146 560 560 GraphicsContext context(platformContext); 561 561 562 _private->coreFrame-> paint(&context, enclosingIntRect(rect));562 _private->coreFrame->view()->paintContents(&context, enclosingIntRect(rect)); 563 563 } 564 564 -
trunk/WebKit/win/ChangeLog
r37105 r37146 1 2008-09-30 Dave Hyatt <hyatt@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=21269 4 5 This patch makes the ScrollView::paint method cross-platform. The paint method calls the base class 6 Widget paint on platforms with native widgets (Mac and wx). Otherwise it calls a virtual function, 7 paintContents, to paint the ScrollView's contents, and then it paints each of the two scrollbars and 8 the scrollbar corner. 9 10 The scrollbar themes are now responsible for painting scrollbar corners. At the moment ScrollbarThemeWin still 11 paints white (which is incorrect), so a future patch will actually implement proper native scroll corner painting 12 for Windows. 13 14 paintContents is implemented by FrameView, and replaces Frame::paint. All of the FramePrivate member 15 variables used by Frame::paint have moved to FrameViewPrivate instead. All callers of Frame::paint have 16 been patched to use FrameView::paintContents instead. 17 18 Reviewed by Darin Adler 19 20 * WebFrame.cpp: 21 (WebFrame::paintDocumentRectToContext): 22 (WebFrame::spoolPages): 23 1 24 2008-09-30 Dave Hyatt <hyatt@apple.com> 2 25 -
trunk/WebKit/win/WebFrame.cpp
r36971 r37146 322 322 gc.clip(dirtyRect); 323 323 gc.translate(-rect.left, -rect.top); 324 coreFrame->paint(&gc, rect);324 view->paintContents(&gc, rect); 325 325 gc.restore(); 326 326 … … 1840 1840 CGContextSetBaseCTM(pctx, ctm); 1841 1841 1842 coreFrame-> paint(&spoolCtx, pageRect);1842 coreFrame->view()->paintContents(&spoolCtx, pageRect); 1843 1843 1844 1844 if (ui2) {
Note: See TracChangeset
for help on using the changeset viewer.