Changeset 13396 in webkit
- Timestamp:
- Mar 19, 2006 11:30:24 PM (18 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r13395 r13396 1 2006-03-17 Eric Seidel <eseidel@apple.com> 2 3 Reviewed by darin. 4 5 Move Form code from MacFrame to Frame. 6 Move GraphicsContext code from GraphicsContextMac to GraphicsContext. 7 Use IntRect, FloatRect in more places throughout the code. 8 http://bugzilla.opendarwin.org/show_bug.cgi?id=7824 9 10 * bridge/mac/MacFrame.h: 11 * bridge/mac/MacFrame.mm: 12 (WebCore::MacFrame::MacFrame): 13 (WebCore::MacFrame::searchForLabelsAboveCell): 14 (WebCore::MacFrame::searchForLabelsBeforeElement): 15 (WebCore::dictionaryFromHashMap): 16 (WebCore::MacFrame::submitForm): 17 (WebCore::MacFrame::setView): 18 (WebCore::MacFrame::currentEventIsMouseDownInWidget): 19 (WebCore::MacFrame::currentEventIsKeyboardOptionTab): 20 (WebCore::MacFrame::handleKeyboardOptionTabInView): 21 (WebCore::MacFrame::tabsToAllControls): 22 (WebCore::MacFrame::shouldDragAutoNode): 23 (WebCore::MacFrame::selectionImage): 24 (WebCore::MacFrame::snapshotDragImage): 25 * bridge/mac/WebCoreFrameBridge.mm: 26 (-[WebCoreFrameBridge nextKeyView]): 27 (-[WebCoreFrameBridge previousKeyView]): 28 (-[WebCoreFrameBridge nextKeyViewInsideWebFrameViews]): 29 (-[WebCoreFrameBridge previousKeyViewInsideWebFrameViews]): 30 * kcanvas/RenderSVGImage.cpp: 31 (WebCore::RenderSVGImage::paint): 32 * page/Frame.cpp: 33 (WebCore::Frame::Frame): 34 (WebCore::Frame::clearRecordedFormValues): 35 (WebCore::Frame::recordFormValue): 36 (WebCore::Frame::didNotOpenURL): 37 (WebCore::scanForForm): 38 (WebCore::Frame::paint): 39 (WebCore::Frame::prepareForUserAction): 40 * page/Frame.h: 41 * platform/GraphicsContext.cpp: 42 (WebCore::GraphicsContextState::GraphicsContextState): 43 (WebCore::GraphicsContextPrivate::GraphicsContextPrivate): 44 (WebCore::GraphicsContextPrivate::~GraphicsContextPrivate): 45 (WebCore::GraphicsContext::save): 46 (WebCore::GraphicsContext::restore): 47 (WebCore::GraphicsContext::font): 48 (WebCore::GraphicsContext::setFont): 49 (WebCore::GraphicsContext::pen): 50 (WebCore::GraphicsContext::setPen): 51 (WebCore::GraphicsContext::setBrush): 52 (WebCore::GraphicsContext::brush): 53 (WebCore::GraphicsContext::setUsesInactiveTextBackgroundColor): 54 (WebCore::GraphicsContext::usesInactiveTextBackgroundColor): 55 (WebCore::GraphicsContext::updatingControlTints): 56 (WebCore::GraphicsContext::setUpdatingControlTints): 57 (WebCore::GraphicsContext::setPaintingDisabled): 58 (WebCore::GraphicsContext::paintingDisabled): 59 (WebCore::GraphicsContext::printing): 60 (WebCore::GraphicsContext::drawImageAtPoint): 61 (WebCore::GraphicsContext::drawImageInRect): 62 (WebCore::GraphicsContext::drawImage): 63 (WebCore::GraphicsContext::initFocusRing): 64 (WebCore::GraphicsContext::clearFocusRing): 65 (WebCore::GraphicsContext::addFocusRingRect): 66 (WebCore::GraphicsContext::focusRingWidth): 67 (WebCore::GraphicsContext::focusRingOffset): 68 (WebCore::GraphicsContext::focusRingRects): 69 * platform/GraphicsContext.h: 70 * platform/mac/GraphicsContextMac.mm: 71 (WebCore::fillRectSourceOver): 72 (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate): 73 (WebCore::GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate): 74 (WebCore::GraphicsContext::GraphicsContext): 75 (WebCore::GraphicsContext::~GraphicsContext): 76 (WebCore::GraphicsContext::savePlatformState): 77 (WebCore::GraphicsContext::restorePlatformState): 78 (WebCore::GraphicsContext::drawRect): 79 (WebCore::GraphicsContext::setColorFromBrush): 80 (WebCore::GraphicsContext::setColorFromPen): 81 (WebCore::GraphicsContext::drawLine): 82 (WebCore::GraphicsContext::drawEllipse): 83 (WebCore::GraphicsContext::drawArc): 84 (WebCore::GraphicsContext::drawConvexPolygon): 85 (WebCore::GraphicsContext::drawFloatImage): 86 (WebCore::GraphicsContext::drawTiledImage): 87 (WebCore::GraphicsContext::drawScaledAndTiledImage): 88 (WebCore::GraphicsContext::selectedTextBackgroundColor): 89 (WebCore::GraphicsContext::fillRect): 90 (WebCore::GraphicsContext::addClip): 91 (WebCore::GraphicsContext::addRoundedRectClip): 92 (WebCore::GraphicsContext::beginTransparencyLayer): 93 (WebCore::GraphicsContext::endTransparencyLayer): 94 (WebCore::GraphicsContext::setShadow): 95 (WebCore::GraphicsContext::clearShadow): 96 (WebCore::GraphicsContext::drawFocusRing): 97 * rendering/render_box.cpp: 98 (WebCore::RenderBox::paintBackgroundExtended): 99 (WebCore::RenderBox::outlineBox): 100 * rendering/render_frames.cpp: 101 (WebCore::RenderFrameSet::userResize): 102 * rendering/render_image.cpp: 103 (WebCore::RenderImage::paint): 104 * rendering/render_list.cpp: 105 (WebCore::RenderListMarker::paint): 106 * rendering/render_object.cpp: 107 (WebCore::RenderObject::drawBorder): 108 (WebCore::RenderObject::paintBorderImage): 109 1 110 2006-03-19 Darin Adler <darin@apple.com> 2 111 -
trunk/WebCore/bridge/mac/FrameMac.h
r13393 r13396 233 233 virtual bool passWheelEventToChildWidget(Node *); 234 234 235 virtual void clearRecordedFormValues();236 virtual void recordFormValue(const DeprecatedString &name, const DeprecatedString &value, HTMLFormElement *element);237 238 235 NSString *searchForLabelsAboveCell(RegularExpression *regExp, HTMLTableCellElement *cell); 239 236 NSString *searchForLabelsBeforeElement(NSArray *labels, Element *element); -
trunk/WebCore/bridge/mac/FrameMac.mm
r13393 r13396 443 443 } 444 444 445 void FrameMac::clearRecordedFormValues()446 {447 // It's safe to assume that our own classes and Foundation data448 // structures won't raise exceptions in dealloc449 450 KWQRelease(_formValuesAboutToBeSubmitted);451 _formValuesAboutToBeSubmitted = nil;452 KWQRelease(_formAboutToBeSubmitted);453 _formAboutToBeSubmitted = nil;454 }455 456 void FrameMac::recordFormValue(const DeprecatedString &name, const DeprecatedString &value, HTMLFormElement *element)457 {458 // It's safe to assume that our own classes and basic Foundation459 // data structures won't raise exceptions460 461 if (!_formValuesAboutToBeSubmitted) {462 _formValuesAboutToBeSubmitted = KWQRetainNSRelease([[NSMutableDictionary alloc] init]);463 ASSERT(!_formAboutToBeSubmitted);464 _formAboutToBeSubmitted = KWQRetain([DOMElement _elementWith:element]);465 } else {466 ASSERT([_formAboutToBeSubmitted _element] == element);467 }468 [_formValuesAboutToBeSubmitted setObject:value.getNSString() forKey:name.getNSString()];469 }470 471 445 void FrameMac::submitForm(const ResourceRequest& request) 472 446 { … … 482 456 // FIXME: Frame targeting is only one of the ways the submission could end up doing something other 483 457 // than replacing this frame's content, so this check is flawed. On the other hand, the check is hardly 484 // needed any more now that we reset _submittedFormURL on each mouse or key down event.458 // needed any more now that we reset d->m_submittedFormURL on each mouse or key down event. 485 459 WebCoreFrameBridge *target = request.frameName.isEmpty() ? _bridge : [_bridge findFrameNamed:request.frameName.getNSString()]; 486 460 Frame *targetPart = [target impl]; … … 493 467 } 494 468 if (willReplaceThisFrame) { 495 if ( _submittedFormURL == request.url()) {469 if (d->m_submittedFormURL == request.url()) 496 470 return; 497 } 498 _submittedFormURL = request.url(); 471 d->m_submittedFormURL = request.url(); 499 472 } 500 473 … … 630 603 // Since this part may be getting reused as a result of being 631 604 // pulled from the back/forward cache, reset this flag. 632 _submittedFormURL = KURL();605 d->m_submittedFormURL = KURL(); 633 606 } 634 607 … … 2706 2679 NSImage *FrameMac::selectionImage() const 2707 2680 { 2708 _drawSelectionOnly = true; // invoke special drawing mode2681 d->m_drawSelectionOnly = true; // invoke special drawing mode 2709 2682 NSImage *result = imageFromRect(visibleSelectionRect()); 2710 _drawSelectionOnly = false;2683 d->m_drawSelectionOnly = false; 2711 2684 return result; 2712 2685 } … … 2715 2688 { 2716 2689 RenderObject *renderer = node->renderer(); 2717 if (!renderer) {2690 if (!renderer) 2718 2691 return nil; 2719 }2720 2692 2721 2693 renderer->updateDragState(true); // mark dragged nodes (so they pick up the right CSS) … … 2725 2697 NSRect paintingRect = renderer->paintingRootRect(topLevelRect); 2726 2698 2727 _elementToDraw = node; // invoke special sub-tree drawing mode2699 d->m_elementToDraw = node; // invoke special sub-tree drawing mode 2728 2700 NSImage *result = imageFromRect(paintingRect); 2729 2701 renderer->updateDragState(false); 2730 2702 d->m_doc->updateLayout(); 2731 _elementToDraw = 0;2732 2733 if (elementRect) {2703 d->m_elementToDraw = 0; 2704 2705 if (elementRect) 2734 2706 *elementRect = topLevelRect; 2735 } 2736 if (imageRect) { 2707 if (imageRect) 2737 2708 *imageRect = paintingRect; 2738 }2739 2709 return result; 2740 2710 } … … 3306 3276 3307 3277 if (attributes == nil) { 3308 m_markedTextUsesUnderlines = false;3309 m_markedTextUnderlines.clear();3278 d->m_markedTextUsesUnderlines = false; 3279 d->m_markedTextUnderlines.clear(); 3310 3280 } else { 3311 m_markedTextUsesUnderlines = true;3312 m_markedTextUnderlines = convertAttributesToUnderlines(range, attributes, ranges);3281 d->m_markedTextUsesUnderlines = true; 3282 d->m_markedTextUnderlines = convertAttributesToUnderlines(range, attributes, ranges); 3313 3283 } 3314 3284 … … 3316 3286 m_markedTextRange->startContainer(exception)->renderer()->repaint(); 3317 3287 3318 if ( range && range->collapsed(exception) ) {3288 if (range && range->collapsed(exception)) 3319 3289 m_markedTextRange = 0; 3320 } else {3290 else 3321 3291 m_markedTextRange = const_cast<Range *>(range); 3322 } 3323 3324 if (m_markedTextRange.get() && document() && m_markedTextRange->startContainer(exception)->renderer()) { 3292 3293 if (m_markedTextRange.get() && document() && m_markedTextRange->startContainer(exception)->renderer()) 3325 3294 m_markedTextRange->startContainer(exception)->renderer()->repaint(); 3326 }3327 3295 } 3328 3296 … … 3340 3308 { 3341 3309 Document *doc = document(); 3342 if (!doc) {3310 if (!doc) 3343 3311 return nil; 3344 }3345 3312 3346 3313 const DeprecatedValueList<DashboardRegionValue> regions = doc->dashboardRegions(); -
trunk/WebCore/bridge/mac/WebCoreFrameBridge.mm
r13393 r13396 1263 1263 { 1264 1264 Document *doc = m_frame->document(); 1265 if (!doc) {1265 if (!doc) 1266 1266 return nil; 1267 }1268 1267 return m_frame->nextKeyView(doc->focusNode(), KWQSelectingNext); 1269 1268 } … … 1272 1271 { 1273 1272 Document *doc = m_frame->document(); 1274 if (!doc) {1273 if (!doc) 1275 1274 return nil; 1276 }1277 1275 return m_frame->nextKeyView(doc->focusNode(), KWQSelectingPrevious); 1278 1276 } … … 1281 1279 { 1282 1280 Document *doc = m_frame->document(); 1283 if (!doc) {1281 if (!doc) 1284 1282 return nil; 1285 }1286 1287 1283 return m_frame->nextKeyViewInFrameHierarchy(doc->focusNode(), KWQSelectingNext); 1288 1284 } … … 1291 1287 { 1292 1288 Document *doc = m_frame->document(); 1293 if (!doc) {1289 if (!doc) 1294 1290 return nil; 1295 }1296 1297 1291 return m_frame->nextKeyViewInFrameHierarchy(doc->focusNode(), KWQSelectingPrevious); 1298 1292 } -
trunk/WebCore/kcanvas/RenderSVGImage.cpp
r13393 r13396 171 171 FloatRect srcRect(0, 0, image()->width(), image()->height()); 172 172 adjustRectsForAspectRatio(destRect, srcRect, imageElt->preserveAspectRatio()->baseVal()); 173 paintInfo.p->drawFloatImage(image(), 174 destRect.x(), destRect.y(), destRect.width(), destRect.height(), 173 paintInfo.p->drawImage(image(), destRect, 175 174 srcRect.x(), srcRect.y(), srcRect.width(), srcRect.height(), 176 175 Image::CompositeSourceOver); -
trunk/WebCore/khtml/html/HTMLFormElement.cpp
r13393 r13396 353 353 if (input->inputType() == HTMLInputElement::TEXT 354 354 || input->inputType() == HTMLInputElement::PASSWORD 355 || input->inputType() == HTMLInputElement::SEARCH) 356 { 355 || input->inputType() == HTMLInputElement::SEARCH) { 357 356 frame->recordFormValue(input->name().deprecatedString(), input->value().deprecatedString(), this); 358 357 if (input->renderer() && input->inputType() == HTMLInputElement::SEARCH) … … 362 361 363 362 if (needButtonActivation) { 364 if (current->isActivatedSubmit()) {363 if (current->isActivatedSubmit()) 365 364 needButtonActivation = false; 366 } else if (firstSuccessfulSubmitButton == 0 && current->isSuccessfulSubmitButton()) {365 else if (firstSuccessfulSubmitButton == 0 && current->isSuccessfulSubmitButton()) 367 366 firstSuccessfulSubmitButton = current; 368 } 369 } 370 } 371 372 if (needButtonActivation && firstSuccessfulSubmitButton) { 367 } 368 } 369 370 if (needButtonActivation && firstSuccessfulSubmitButton) 373 371 firstSuccessfulSubmitButton->setActivatedSubmit(true); 374 }375 372 376 373 if (!m_post) … … 379 376 FormData form_data; 380 377 if (formData(form_data)) { 381 if(m_post) {382 frame->submitForm( 378 if(m_post) 379 frame->submitForm("post", m_url.deprecatedString(), form_data, 383 380 m_target.deprecatedString(), 384 381 enctype().deprecatedString(), 385 boundary().deprecatedString() ); 386 } 387 else { 388 frame->submitForm( "get", m_url.deprecatedString(), form_data, 389 m_target.deprecatedString() ); 390 } 391 } 392 393 if (needButtonActivation && firstSuccessfulSubmitButton) { 382 boundary().deprecatedString()); 383 else 384 frame->submitForm("get", m_url.deprecatedString(), form_data, m_target.deprecatedString()); 385 } 386 387 if (needButtonActivation && firstSuccessfulSubmitButton) 394 388 firstSuccessfulSubmitButton->setActivatedSubmit(false); 395 }396 389 397 390 m_doingsubmit = m_insubmit = false; 398 391 } 399 392 400 void HTMLFormElement::reset( 393 void HTMLFormElement::reset() 401 394 { 402 395 Frame *frame = getDocument()->frame(); 403 if(m_inreset || !frame) return; 396 if (m_inreset || !frame) 397 return; 404 398 405 399 m_inreset = true; … … 420 414 void HTMLFormElement::parseMappedAttribute(MappedAttribute *attr) 421 415 { 422 if (attr->name() == actionAttr) 423 { 416 if (attr->name() == actionAttr) { 424 417 bool oldURLWasSecure = formWouldHaveSecureSubmission(m_url); 425 418 m_url = WebCore::parseURL(attr->value()); … … 432 425 getDocument()->secureFormRemoved(); 433 426 } 434 else if (attr->name() == targetAttr) {427 else if (attr->name() == targetAttr) 435 428 m_target = attr->value(); 436 }else if (attr->name() == methodAttr) {429 else if (attr->name() == methodAttr) { 437 430 if (equalIgnoringCase(attr->value(), "post")) 438 431 m_post = true; 439 432 else if (equalIgnoringCase(attr->value(), "get")) 440 433 m_post = false; 441 } else if (attr->name() == enctypeAttr) {434 } else if (attr->name() == enctypeAttr) 442 435 parseEnctype(attr->value()); 443 } else if (attr->name() == accept_charsetAttr) {436 else if (attr->name() == accept_charsetAttr) 444 437 // space separated list of charsets the server 445 438 // accepts - see rfc2045 446 439 m_acceptcharset = attr->value(); 447 }else if (attr->name() == acceptAttr) {440 else if (attr->name() == acceptAttr) { 448 441 // ignore this one for the moment... 449 } else if (attr->name() == autocompleteAttr) {442 } else if (attr->name() == autocompleteAttr) 450 443 m_autocomplete = !equalIgnoringCase(attr->value(), "off"); 451 } else if (attr->name() == onsubmitAttr) {444 else if (attr->name() == onsubmitAttr) 452 445 setHTMLEventListener(submitEvent, attr); 453 } else if (attr->name() == onresetAttr) {446 else if (attr->name() == onresetAttr) 454 447 setHTMLEventListener(resetEvent, attr); 455 }else if (attr->name() == nameAttr) {448 else if (attr->name() == nameAttr) { 456 449 String newNameAttr = attr->value(); 457 450 if (inDocument() && getDocument()->isHTMLDocument()) { -
trunk/WebCore/page/Frame.cpp
r13393 r13396 147 147 Frame::Frame(Page* page, RenderPart* ownerRenderer) 148 148 : d(new FramePrivate(page, parentFromOwnerRenderer(ownerRenderer), this, ownerRenderer)) 149 , _drawSelectionOnly(false)150 , m_markedTextUsesUnderlines(false)151 , m_windowHasFocus(false)152 , frameCount(0)153 149 { 154 150 AtomicString::init(); … … 1466 1462 } 1467 1463 1464 void Frame::clearRecordedFormValues() 1465 { 1466 d->m_formAboutToBeSubmitted = 0; 1467 d->m_formValuesAboutToBeSubmitted.clear(); 1468 } 1469 1470 void Frame::recordFormValue(const String& name, const String& value, PassRefPtr<HTMLFormElement> element) 1471 { 1472 d->m_formAboutToBeSubmitted = element; 1473 d->m_formValuesAboutToBeSubmitted.set(name, value); 1474 } 1475 1468 1476 void Frame::submitFormAgain() 1469 1477 { … … 1570 1578 } 1571 1579 } 1572 1573 1580 1574 1581 void Frame::parentCompleted() … … 2570 2577 void Frame::didNotOpenURL(const KURL &URL) 2571 2578 { 2572 if (_submittedFormURL == URL) { 2573 _submittedFormURL = KURL(); 2574 } 2579 if (d->m_submittedFormURL == URL) 2580 d->m_submittedFormURL = KURL(); 2575 2581 } 2576 2582 … … 2580 2586 Node *n; 2581 2587 for (n = start; n; n = n->traverseNextNode()) { 2582 if (n->hasTagName(formTag)) {2588 if (n->hasTagName(formTag)) 2583 2589 return static_cast<HTMLFormElement *>(n); 2584 } else if (n->isHTMLElement() 2585 && static_cast<HTMLElement *>(n)->isGenericFormElement()) { 2586 return static_cast<HTMLGenericFormElement *>(n)->form(); 2587 } else if (n->hasTagName(frameTag) || n->hasTagName(iframeTag)) { 2590 else if (n->isHTMLElement() && static_cast<HTMLElement*>(n)->isGenericFormElement()) 2591 return static_cast<HTMLGenericFormElement*>(n)->form(); 2592 else if (n->hasTagName(frameTag) || n->hasTagName(iframeTag)) { 2588 2593 Node *childDoc = static_cast<HTMLFrameElement *>(n)->contentDocument(); 2589 HTMLFormElement *frameResult = scanForForm(childDoc); 2590 if (frameResult) { 2594 if (HTMLFormElement *frameResult = scanForForm(childDoc)) 2591 2595 return frameResult; 2592 }2593 2596 } 2594 2597 } … … 2728 2731 else if (view() && view()->isTransparent()) 2729 2732 fillWithRed = false; // Transparent, don't fill with red. 2730 else if ( _drawSelectionOnly)2733 else if (d->m_drawSelectionOnly) 2731 2734 fillWithRed = false; // Selections are transparent, don't fill with red. 2732 else if ( _elementToDraw)2735 else if (d->m_elementToDraw) 2733 2736 fillWithRed = false; // Element images are transparent, don't fill with red. 2734 2737 else … … 2740 2743 2741 2744 if (renderer()) { 2742 // _elementToDraw is used to draw only one element2743 RenderObject *eltRenderer = _elementToDraw ?_elementToDraw->renderer() : 0;2744 renderer()->layer()->paint(p, rect, _drawSelectionOnly, eltRenderer);2745 // d->m_elementToDraw is used to draw only one element 2746 RenderObject *eltRenderer = d->m_elementToDraw ? d->m_elementToDraw->renderer() : 0; 2747 renderer()->layer()->paint(p, rect, d->m_drawSelectionOnly, eltRenderer); 2745 2748 2746 2749 #if __APPLE__ … … 3216 3219 void Frame::setWindowHasFocus(bool flag) 3217 3220 { 3218 if ( m_windowHasFocus == flag)3219 return; 3220 m_windowHasFocus = flag;3221 if (d->m_windowHasFocus == flag) 3222 return; 3223 d->m_windowHasFocus = flag; 3221 3224 3222 3225 if (Document *doc = document()) … … 3238 3241 bool Frame::markedTextUsesUnderlines() const 3239 3242 { 3240 return m_markedTextUsesUnderlines;3243 return d->m_markedTextUsesUnderlines; 3241 3244 } 3242 3245 3243 3246 DeprecatedValueList<MarkedTextUnderline> Frame::markedTextUnderlines() const 3244 3247 { 3245 return m_markedTextUnderlines;3248 return d->m_markedTextUnderlines; 3246 3249 } 3247 3250 … … 3274 3277 // Reset the multiple form submission protection code. 3275 3278 // We'll let you submit the same form twice if you do two separate user actions. 3276 _submittedFormURL = KURL();3279 d->m_submittedFormURL = KURL(); 3277 3280 } 3278 3281 -
trunk/WebCore/page/Frame.h
r13393 r13396 554 554 virtual DeprecatedString incomingReferrer() const = 0; 555 555 virtual DeprecatedString mimeTypeForFileName(const DeprecatedString &) const = 0; 556 virtual void clearRecordedFormValues() = 0;557 virtual void recordFormValue(const DeprecatedString &name, const DeprecatedString &value, HTMLFormElement *element) = 0;558 556 virtual KJS::Bindings::Instance *getEmbedInstanceForWidget(Widget*) = 0; 559 557 virtual KJS::Bindings::Instance *getObjectInstanceForWidget(Widget*) = 0; … … 765 763 void prepareForUserAction(); 766 764 Node *mousePressNode(); 765 766 void clearRecordedFormValues(); 767 void recordFormValue(const String& name, const String& value, PassRefPtr<HTMLFormElement>); 767 768 768 769 bool isComplete() const; … … 829 830 friend class FramePrivate; 830 831 FramePrivate* d; 831 832 mutable RefPtr<Node> _elementToDraw;833 mutable bool _drawSelectionOnly;834 KURL _submittedFormURL;835 bool m_markedTextUsesUnderlines;836 DeprecatedValueList<MarkedTextUnderline> m_markedTextUnderlines;837 bool m_windowHasFocus;838 int frameCount;839 832 }; 840 833 -
trunk/WebCore/page/FramePrivate.h
r13393 r13396 97 97 , m_autoscrollTimer(thisFrame, &Frame::autoscrollTimerFired) 98 98 , m_autoscrollLayer(0) 99 , m_drawSelectionOnly(false) 100 , m_markedTextUsesUnderlines(false) 101 , m_windowHasFocus(false) 102 , frameCount(0) 99 103 { 100 104 } … … 208 212 Timer<Frame> m_autoscrollTimer; 209 213 RenderLayer* m_autoscrollLayer; 214 215 RefPtr<Node> m_elementToDraw; 216 bool m_drawSelectionOnly; 217 218 HashMap<String, String> m_formValuesAboutToBeSubmitted; 219 RefPtr<Element> m_formAboutToBeSubmitted; 220 KURL m_submittedFormURL; 221 222 bool m_markedTextUsesUnderlines; 223 DeprecatedValueList<MarkedTextUnderline> m_markedTextUnderlines; 224 bool m_windowHasFocus; 225 226 unsigned frameCount; 210 227 }; 211 212 228 } 213 229 -
trunk/WebCore/platform/GraphicsContext.cpp
r13393 r13396 27 27 #include "GraphicsContext.h" 28 28 29 #include "FloatRect.h" 30 #include "Font.h" 29 31 #include "IntRect.h" 30 32 #include "DeprecatedString.h" 31 #include "Font.h"32 33 #include "Widget.h" 33 34 34 35 namespace WebCore { 36 37 struct GraphicsContextState { 38 GraphicsContextState() : paintingDisabled(false) { } 39 Font font; 40 Pen pen; 41 Brush brush; 42 bool paintingDisabled; 43 }; 44 45 struct GraphicsContextPrivate { 46 GraphicsContextPrivate(bool isForPrinting); 47 48 GraphicsContextState state; 49 Vector<GraphicsContextState> stack; 50 Vector<IntRect> m_focusRingRects; 51 int m_focusRingWidth; 52 int m_focusRingOffset; 53 bool m_isForPrinting; 54 bool m_usesInactiveTextBackgroundColor; 55 bool m_updatingControlTints; 56 }; 57 58 GraphicsContextPrivate::GraphicsContextPrivate(bool isForPrinting) 59 : m_focusRingWidth(0) 60 , m_focusRingOffset(0) 61 , m_isForPrinting(isForPrinting) 62 , m_usesInactiveTextBackgroundColor(false) 63 , m_updatingControlTints(false) 64 { 65 } 66 67 GraphicsContextPrivate* GraphicsContext::createGraphicsContextPrivate(bool isForPrinting) 68 { 69 return new GraphicsContextPrivate(isForPrinting); 70 } 71 72 void GraphicsContext::destroyGraphicsContextPrivate(GraphicsContextPrivate* deleteMe) 73 { 74 delete deleteMe; 75 } 76 77 void GraphicsContext::save() 78 { 79 if (paintingDisabled()) 80 return; 81 82 m_common->stack.append(m_common->state); 83 84 savePlatformState(); 85 } 86 87 void GraphicsContext::restore() 88 { 89 if (paintingDisabled()) 90 return; 91 92 if (m_common->stack.isEmpty()) { 93 LOG_ERROR("ERROR void GraphicsContext::restore() stack is empty"); 94 return; 95 } 96 m_common->state = m_common->stack.last(); 97 m_common->stack.removeLast(); 98 99 restorePlatformState(); 100 } 101 102 const Font& GraphicsContext::font() const 103 { 104 return m_common->state.font; 105 } 106 107 void GraphicsContext::setFont(const Font& aFont) 108 { 109 m_common->state.font = aFont; 110 } 111 112 const Pen& GraphicsContext::pen() const 113 { 114 return m_common->state.pen; 115 } 116 117 void GraphicsContext::setPen(const Pen& pen) 118 { 119 m_common->state.pen = pen; 120 } 121 122 void GraphicsContext::setPen(Pen::PenStyle style) 123 { 124 m_common->state.pen.setStyle(style); 125 m_common->state.pen.setColor(Color::black); 126 m_common->state.pen.setWidth(0); 127 } 128 129 void GraphicsContext::setPen(RGBA32 rgb) 130 { 131 m_common->state.pen.setStyle(Pen::SolidLine); 132 m_common->state.pen.setColor(rgb); 133 m_common->state.pen.setWidth(0); 134 } 135 136 void GraphicsContext::setBrush(const Brush& brush) 137 { 138 m_common->state.brush = brush; 139 } 140 141 void GraphicsContext::setBrush(Brush::BrushStyle style) 142 { 143 m_common->state.brush.setStyle(style); 144 m_common->state.brush.setColor(Color::black); 145 } 146 147 void GraphicsContext::setBrush(RGBA32 rgb) 148 { 149 m_common->state.brush.setStyle(Brush::SolidPattern); 150 m_common->state.brush.setColor(rgb); 151 } 152 153 const Brush& GraphicsContext::brush() const 154 { 155 return m_common->state.brush; 156 } 157 158 void GraphicsContext::setUsesInactiveTextBackgroundColor(bool u) 159 { 160 m_common->m_usesInactiveTextBackgroundColor = u; 161 } 162 163 bool GraphicsContext::usesInactiveTextBackgroundColor() const 164 { 165 return m_common->m_usesInactiveTextBackgroundColor; 166 } 167 168 bool GraphicsContext::updatingControlTints() const 169 { 170 return m_common->m_updatingControlTints; 171 } 172 173 void GraphicsContext::setUpdatingControlTints(bool b) 174 { 175 setPaintingDisabled(b); 176 m_common->m_updatingControlTints = b; 177 } 178 179 void GraphicsContext::setPaintingDisabled(bool f) 180 { 181 m_common->state.paintingDisabled = f; 182 } 183 184 bool GraphicsContext::paintingDisabled() const 185 { 186 return m_common->state.paintingDisabled; 187 } 188 189 bool GraphicsContext::printing() const 190 { 191 return m_common->m_isForPrinting; 192 } 35 193 36 194 void GraphicsContext::drawImageAtPoint(Image* image, const IntPoint& p, Image::CompositeOperator compositeOperator) 37 195 { 38 drawImage(image, p .x(), p.y(), 0, 0, -1, -1, compositeOperator);196 drawImage(image, p, 0, 0, -1, -1, compositeOperator); 39 197 } 40 198 41 199 void GraphicsContext::drawImageInRect(Image* image, const IntRect& r, Image::CompositeOperator compositeOperator) 42 200 { 43 drawImage(image, r .x(), r.y(), r.width(), r.height(), 0, 0, -1, -1, compositeOperator);44 } 45 46 void GraphicsContext::drawImage(Image* image, int x, int y,201 drawImage(image, r, 0, 0, -1, -1, compositeOperator); 202 } 203 204 void GraphicsContext::drawImage(Image* image, const IntPoint& dest, 47 205 int sx, int sy, int sw, int sh, Image::CompositeOperator compositeOperator, void* context) 48 206 { 49 drawImage(image, x, y, sw, sh, sx, sy, sw, sh, compositeOperator, context);50 } 51 52 void GraphicsContext::drawImage(Image* image, int x, int y, int w, int h,207 drawImage(image, IntRect(dest, IntSize(sw, sh)), sx, sy, sw, sh, compositeOperator, context); 208 } 209 210 void GraphicsContext::drawImage(Image* image, const IntRect& dest, 53 211 int sx, int sy, int sw, int sh, Image::CompositeOperator compositeOperator, void* context) 54 212 { 55 draw FloatImage(image, (float)x, (float)y, (float)w, (float)h, (float)sx, (float)sy, (float)sw, (float)sh, compositeOperator, context);213 drawImage(image, FloatRect(dest), (float)sx, (float)sy, (float)sw, (float)sh, compositeOperator, context); 56 214 } 57 215 … … 125 283 clearFocusRing(); 126 284 127 m_ focusRingWidth = width;128 m_ focusRingOffset = offset;285 m_common->m_focusRingWidth = width; 286 m_common->m_focusRingOffset = offset; 129 287 } 130 288 131 289 void GraphicsContext::clearFocusRing() 132 290 { 133 m_ focusRingRects.clear();291 m_common->m_focusRingRects.clear(); 134 292 } 135 293 … … 138 296 if (paintingDisabled()) 139 297 return; 140 m_focusRingRects.append(rect); 141 } 142 143 } 298 m_common->m_focusRingRects.append(rect); 299 } 300 301 int GraphicsContext::focusRingWidth() const 302 { 303 return m_common->m_focusRingWidth; 304 } 305 306 int GraphicsContext::focusRingOffset() const 307 { 308 return m_common->m_focusRingOffset; 309 } 310 311 const Vector<IntRect>& GraphicsContext::focusRingRects() const 312 { 313 return m_common->m_focusRingRects; 314 } 315 316 } -
trunk/WebCore/platform/GraphicsContext.h
r13393 r13396 49 49 class Font; 50 50 class GraphicsContextPrivate; 51 class GraphicsContextPlatformPrivate; 51 52 class IntPoint; 52 53 class IntPointArray; … … 92 93 void restore(); 93 94 94 void drawRect( int, int, int, int);95 void drawLine( int, int, int, int);96 void drawEllipse( int, int, int, int);95 void drawRect(const IntRect&); 96 void drawLine(const IntPoint&, const IntPoint&); 97 void drawEllipse(const IntRect&); 97 98 void drawArc(int, int, int, int, int, int); 98 99 void drawConvexPolygon(const IntPointArray&); 99 100 100 void fillRect(int, int, int, int, const Brush&);101 101 void fillRect(const IntRect&, const Brush&); 102 102 … … 104 104 void drawImageInRect(Image*, const IntRect&, Image::CompositeOperator = Image::CompositeSourceOver); 105 105 106 void drawImage(Image*, int x, int y,106 void drawImage(Image*, const IntPoint&, 107 107 int sx = 0, int sy = 0, int sw = -1, int sh = -1, 108 108 Image::CompositeOperator = Image::CompositeSourceOver, 109 109 void* nativeData = 0); 110 void drawImage(Image*, int x, int y, int w, int h,110 void drawImage(Image*, const IntRect&, 111 111 int sx = 0, int sy = 0, int sw = -1, int sh = -1, 112 112 Image::CompositeOperator = Image::CompositeSourceOver, 113 113 void* nativeData = 0); 114 void draw FloatImage(Image*, float x, float y, float w, float h,114 void drawImage(Image*, const FloatRect&, 115 115 float sx = 0, float sy = 0, float sw = -1, float sh = -1, 116 116 Image::CompositeOperator = Image::CompositeSourceOver, 117 117 void* nativeData = 0); 118 void drawTiledImage(Image*, int, int, int, int, int sx = 0, int sy = 0, void* nativeData = 0);119 void drawScaledAndTiledImage(Image*, int, int, int, int, int, int, int, int,118 void drawTiledImage(Image*, const IntRect& dest, int sx = 0, int sy = 0, void* nativeData = 0); 119 void drawScaledAndTiledImage(Image*, const IntRect&, int, int, int, int, 120 120 Image::TileRule hRule = Image::StretchTile, Image::TileRule vRule = Image::StretchTile, 121 121 void* nativeData = 0); … … 137 137 138 138 Color selectedTextBackgroundColor() const; 139 void setUsesInactiveTextBackgroundColor(bool u) { m_usesInactiveTextBackgroundColor = u; } 139 void setUsesInactiveTextBackgroundColor(bool); 140 bool usesInactiveTextBackgroundColor() const; 140 141 141 142 bool paintingDisabled() const; 142 143 void setPaintingDisabled(bool); 143 144 144 bool updatingControlTints() const { return m_updatingControlTints; }145 void setUpdatingControlTints(bool b) { setPaintingDisabled(b); m_updatingControlTints = b; }145 bool updatingControlTints() const; 146 void setUpdatingControlTints(bool); 146 147 147 148 void beginTransparencyLayer(float opacity); … … 175 176 #endif 176 177 177 bool printing() const { return m_isForPrinting; }178 bool printing() const; 178 179 179 180 private: 180 181 void setColorFromBrush(); 181 182 void setColorFromPen(); 182 183 GraphicsContextPrivate* m_data; 184 Vector<IntRect> m_focusRingRects; 185 int m_focusRingWidth; 186 int m_focusRingOffset; 187 bool m_isForPrinting; 188 bool m_usesInactiveTextBackgroundColor; 189 bool m_updatingControlTints; 183 184 void savePlatformState(); 185 void restorePlatformState(); 186 187 int focusRingWidth() const; 188 int focusRingOffset() const; 189 const Vector<IntRect>& focusRingRects() const; 190 191 static GraphicsContextPrivate* createGraphicsContextPrivate(bool isForPrinting = false); 192 static void destroyGraphicsContextPrivate(GraphicsContextPrivate*); 193 194 GraphicsContextPrivate* m_common; 195 GraphicsContextPlatformPrivate* m_data; 190 196 }; 191 197 -
trunk/WebCore/platform/cairo/GraphicsContextCairo.cpp
r13393 r13396 42 42 namespace WebCore { 43 43 44 struct GraphicsContextState { 45 GraphicsContextState() : paintingDisabled(false) { } 46 Font font; 47 Pen pen; 48 Brush brush; 49 bool paintingDisabled; 50 }; 51 52 struct GraphicsContextPrivate { 53 GraphicsContextPrivate(); 54 ~GraphicsContextPrivate(); 55 56 GraphicsContextState state; 57 Vector<GraphicsContextState> stack; 44 struct GraphicsContextPlatformPrivate { 45 GraphicsContextPlatformPrivate(); 46 ~GraphicsContextPlatformPrivate(); 47 58 48 cairo_t* context; 59 49 }; … … 67 57 68 58 // A fillRect helper 69 static inline void fillRectSourceOver(cairo_t* cr, float x, float y, float w, float h, const Color& col)59 static inline void fillRectSourceOver(cairo_t* cr, const FloatRect& rect, const Color& col) 70 60 { 71 61 setColor(cr, col); … … 75 65 } 76 66 77 GraphicsContextP rivate::GraphicsContextPrivate()67 GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate() 78 68 : context(0) 79 69 { 80 70 } 81 71 82 GraphicsContextP rivate::~GraphicsContextPrivate()72 GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate() 83 73 { 84 74 cairo_destroy(context); … … 86 76 87 77 GraphicsContext::GraphicsContext(HDC dc) 88 : m_data(new GraphicsContextPrivate) 89 , m_isForPrinting(false) 90 , m_usesInactiveTextBackgroundColor(false) 91 , m_updatingControlTints(false) 78 : m_common(createGraphicsContextPrivate()) 79 , m_data(new GraphicsContextPlatformPrivate) 92 80 { 93 81 cairo_surface_t* surface = cairo_win32_surface_create(dc); … … 96 84 97 85 GraphicsContext::GraphicsContext(cairo_t* context) 98 : m_data(new GraphicsContextPrivate) 99 , m_isForPrinting(false) 100 , m_usesInactiveTextBackgroundColor(false) 101 , m_updatingControlTints(false) 86 : m_common(createGraphicsContextPrivate()) 87 , m_data(new GraphicsContextPlatformPrivate) 102 88 { 103 89 m_data->context = cairo_reference(context); … … 105 91 106 92 GraphicsContext::GraphicsContext(bool forPrinting) 107 : m_data(new GraphicsContextPrivate) 108 , m_isForPrinting(forPrinting) 109 , m_usesInactiveTextBackgroundColor(false) 110 , m_updatingControlTints(false) 93 : m_common(createGraphicsContextPrivate(forPrinting)) 94 , m_data(new GraphicsContextPlatformPrivate) 111 95 { 112 96 } … … 114 98 GraphicsContext::~GraphicsContext() 115 99 { 100 destroyGraphicsContextPrivate(m_common); 116 101 delete m_data; 117 102 } … … 122 107 } 123 108 124 const Pen& GraphicsContext::pen() const 125 { 126 return m_data->state.pen; 127 } 128 129 void GraphicsContext::setPen(const Pen& pen) 130 { 131 m_data->state.pen = pen; 132 } 133 134 void GraphicsContext::setPen(Pen::PenStyle style) 135 { 136 m_data->state.pen.setStyle(style); 137 m_data->state.pen.setColor(Color::black); 138 m_data->state.pen.setWidth(0); 139 } 140 141 void GraphicsContext::setPen(RGBA32 rgb) 142 { 143 m_data->state.pen.setStyle(Pen::SolidLine); 144 m_data->state.pen.setColor(rgb); 145 m_data->state.pen.setWidth(0); 146 } 147 148 void GraphicsContext::setBrush(const Brush& brush) 149 { 150 m_data->state.brush = brush; 151 } 152 153 void GraphicsContext::setBrush(Brush::BrushStyle style) 154 { 155 m_data->state.brush.setStyle(style); 156 m_data->state.brush.setColor(Color::black); 157 } 158 159 void GraphicsContext::setBrush(RGBA32 rgb) 160 { 161 m_data->state.brush.setStyle(Brush::SolidPattern); 162 m_data->state.brush.setColor(rgb); 163 } 164 165 const Brush& GraphicsContext::brush() const 166 { 167 return m_data->state.brush; 168 } 169 170 const Font& GraphicsContext::font() const 171 { 172 return m_data->state.font; 173 } 174 175 void GraphicsContext::setFont(const Font& aFont) 176 { 177 m_data->state.font = aFont; 178 } 179 180 void GraphicsContext::save() 181 { 182 if (m_data->state.paintingDisabled) 183 return; 184 185 m_data->stack.append(m_data->state); 186 109 void GraphicsContext::savePlatformState() 110 { 187 111 cairo_save(m_data->context); 188 112 } 189 113 190 void GraphicsContext::restore() 191 { 192 if (m_data->state.paintingDisabled) 193 return; 194 195 if (m_data->stack.isEmpty()) { 196 LOG_ERROR("ERROR void GraphicsContext::restore() stack is empty"); 197 return; 198 } 199 m_data->state = m_data->stack.last(); 200 m_data->stack.removeLast(); 201 114 void GraphicsContext::restorePlatformState() 115 { 202 116 cairo_restore(m_data->context); 203 117 } 204 118 205 119 // Draws a filled rectangle with a stroked border. 206 void GraphicsContext::drawRect( int x, int y, int w, int h)207 { 208 if ( m_data->state.paintingDisabled)209 return; 210 211 cairo_t* context = m_data->context; 212 if ( m_data->state.brush.style() != Brush::NoBrush)213 fillRectSourceOver(context, x, y, w, h, m_data->state.brush.color());214 215 if ( m_data->state.pen.style() != Pen::NoPen) {120 void GraphicsContext::drawRect(const IntRect& rect) 121 { 122 if (paintingDisabled()) 123 return; 124 125 cairo_t* context = m_data->context; 126 if (brush().style() != Brush::NoBrush) 127 fillRectSourceOver(context, rect, brush().color()); 128 129 if (pen().style() != Pen::NoPen) { 216 130 setColorFromPen(); 217 cairo_rectangle(context, x+.5, y+.5 , w-.5 , h-.5); 131 FloatRect r(rect); 132 r.inflate(-.5f); 133 cairo_rectangle(context, r.x(), r.y(), r.width(), r.height()); 218 134 cairo_set_line_width(context, 1.0); 219 135 cairo_stroke(context); … … 223 139 void GraphicsContext::setColorFromBrush() 224 140 { 225 setColor(m_data->context, m_data->state.brush.color());141 setColor(m_data->context, brush().color()); 226 142 } 227 143 228 144 void GraphicsContext::setColorFromPen() 229 145 { 230 setColor(m_data->context, m_data->state.brush.color());146 setColor(m_data->context, pen().color()); 231 147 } 232 148 … … 264 180 265 181 // This is only used to draw borders. 266 void GraphicsContext::drawLine( int x1, int y1, int x2, int y2)267 { 268 if ( m_data->state.paintingDisabled)182 void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) 183 { 184 if (paintingDisabled()) 269 185 return; 270 186 … … 272 188 cairo_save(context); 273 189 274 Pen::PenStyle penStyle = m_data->state.pen.style();190 Pen::PenStyle penStyle = pen().style(); 275 191 if (penStyle == Pen::NoPen) 276 192 return; 277 float width = m_data->state.pen.width();193 float width = pen().width(); 278 194 if (width < 1) 279 195 width = 1; 280 196 281 FloatPoint p1 = FloatPoint(x1, y1); 282 FloatPoint p2 = FloatPoint(x2, y2); 197 FloatPoint p1 = point1; 198 FloatPoint p2 = point2; 199 bool isVerticalLine = (p1.x() == p2.x()); 283 200 284 201 adjustLineToPixelBounderies(p1, p2, width, penStyle); … … 306 223 // appearance of being a border. We then draw the actual dotted/dashed line. 307 224 if (x1 == x2) { 308 fillRectSourceOver(context, p1.x()-width/2, p1.y()-width, width, width, m_data->state.pen.color());309 fillRectSourceOver(context, p2.x()-width/2, p2.y(), width, width, m_data->state.pen.color());225 fillRectSourceOver(context, FloatRect(p1.x()-width/2, p1.y()-width, width, width), pen().color()); 226 fillRectSourceOver(context, FloatRect(p2.x()-width/2, p2.y(), width, width), pen().color()); 310 227 } else { 311 fillRectSourceOver(context, p1.x()-width, p1.y()-width/2, width, width, m_data->state.pen.color());312 fillRectSourceOver(context, p2.x(), p2.y()-width/2, width, width, m_data->state.pen.color());228 fillRectSourceOver(context, FloatRect(p1.x()-width, p1.y()-width/2, width, width), pen().color()); 229 fillRectSourceOver(context, FloatRect(p2.x(), p2.y()-width/2, width, width), pen().color()); 313 230 } 314 231 … … 316 233 // Remainder is 20. The maximum pixels of line we could paint 317 234 // will be 50 pixels. 318 int distance = ( (x1 == x2) ? (y2 - y1) : (x2 - x1)) - 2*(int)width;235 int distance = (isVerticalLine ? (p2.y() - p1.y()) : (p2.x() - p1.x())) - 2*(int)width; 319 236 int remainder = distance%patWidth; 320 237 int coverage = distance-remainder; … … 355 272 356 273 // This method is only used to draw the little circles used in lists. 357 void GraphicsContext::drawEllipse( int x, int y, int width, int height)358 { 359 if ( m_data->state.paintingDisabled)274 void GraphicsContext::drawEllipse(const IntRect& rect) 275 { 276 if (paintingDisabled()) 360 277 return; 361 278 362 279 cairo_t* context = m_data->context; 363 280 cairo_save(context); 364 float yRadius = .5 * height;365 float xRadius = .5 * width;366 cairo_translate(context, x + xRadius, y+ yRadius);281 float yRadius = .5 * rect.height(); 282 float xRadius = .5 * rect.width(); 283 cairo_translate(context, rect.x() + xRadius, rect.y() + yRadius); 367 284 cairo_scale(context, xRadius, yRadius); 368 285 cairo_arc(context, 0., 0., 1., 0., 2 * M_PI); 369 286 cairo_restore(context); 370 287 371 if ( m_data->state.brush.style() != Brush::NoBrush) {288 if (brush().style() != Brush::NoBrush) { 372 289 setColorFromBrush(); 373 290 cairo_fill(context); 374 291 } 375 if ( m_data->state.pen.style() != Pen::NoPen) {292 if (pen().style() != Pen::NoPen) { 376 293 setColorFromPen(); 377 unsigned penWidth = m_data->state.pen.width();294 unsigned penWidth = pen().width(); 378 295 if (penWidth == 0) 379 296 penWidth++; … … 388 305 ASSERT(w == h); 389 306 390 if ( m_data->state.paintingDisabled)391 return; 392 393 cairo_t* context = m_data->context; 394 if ( m_data->state.pen.style() != Pen::NoPen) {307 if (paintingDisabled()) 308 return; 309 310 cairo_t* context = m_data->context; 311 if (pen().style() != Pen::NoPen) { 395 312 float r = (float)w / 2; 396 313 float fa = (float)a / 16; … … 399 316 400 317 setColorFromPen(); 401 cairo_set_line_width(context, m_data->state.pen.width());318 cairo_set_line_width(context, pen().width()); 402 319 cairo_stroke(context); 403 320 } … … 406 323 void GraphicsContext::drawConvexPolygon(const IntPointArray& points) 407 324 { 408 if ( m_data->state.paintingDisabled)325 if (paintingDisabled()) 409 326 return; 410 327 … … 422 339 cairo_close_path(context); 423 340 424 if ( m_data->state.brush.style() != Brush::NoBrush) {341 if (brush().style() != Brush::NoBrush) { 425 342 setColorFromBrush(); 426 343 cairo_set_fill_rule(context, CAIRO_FILL_RULE_EVEN_ODD); … … 428 345 } 429 346 430 if ( m_data->state.pen.style() != Pen::NoPen) {347 if (pen().style() != Pen::NoPen) { 431 348 setColorFromPen(); 432 cairo_set_line_width(context, m_data->state.pen.width());349 cairo_set_line_width(context, pen().width()); 433 350 cairo_stroke(context); 434 351 } … … 436 353 } 437 354 438 void GraphicsContext::draw FloatImage(Image* image, float x, float y, float w, float h,355 void GraphicsContext::drawImage(Image* image, const FloatRect& destRect, 439 356 float sx, float sy, float sw, float sh, Image::CompositeOperator compositeOperator, void* context) 440 357 { … … 442 359 context = m_data->context; 443 360 444 if ( m_data->state.paintingDisabled)361 if (paintingDisabled()) 445 362 return; 446 363 447 364 float tsw = sw; 448 365 float tsh = sh; 449 float tw = w; 450 float th = h; 451 366 FloatRect dest = destRect; 367 452 368 if (tsw == -1) 453 369 tsw = image->width(); … … 455 371 tsh = image->height(); 456 372 457 if ( tw== -1)458 tw = image->width();459 if ( th== -1)460 th = image->height();461 462 image->drawInRect( FloatRect(x, y, tw, th), FloatRect(sx, sy, tsw, tsh), compositeOperator, context);463 } 464 465 void GraphicsContext::drawTiledImage(Image* image, int x, int y, int w, int h, int sx, int sy, void* context)373 if (dest.width() == -1) 374 dest.setWidth(image->width()); 375 if (dest.height() == -1) 376 dest.setHeight(image->height()); 377 378 image->drawInRect(dest, FloatRect(sx, sy, tsw, tsh), compositeOperator, context); 379 } 380 381 void GraphicsContext::drawTiledImage(Image* image, const IntRect& dest, int sx, int sy, void* context) 466 382 { 467 383 if (!context) 468 384 context = m_data->context; 469 385 470 if ( m_data->state.paintingDisabled)471 return; 472 473 image->tileInRect( FloatRect(x, y, w, h), FloatPoint(sx, sy), context);474 } 475 476 void GraphicsContext::drawScaledAndTiledImage(Image* image, int x, int y, int w, int h, int sx, int sy, int sw, int sh,386 if (paintingDisabled()) 387 return; 388 389 image->tileInRect(dest, FloatPoint(sx, sy), context); 390 } 391 392 void GraphicsContext::drawScaledAndTiledImage(Image* image, const IntRect& dest, int sx, int sy, int sw, int sh, 477 393 Image::TileRule hRule, Image::TileRule vRule, void* context) 478 394 { … … 480 396 context = m_data->context; 481 397 482 if ( m_data->state.paintingDisabled)398 if (paintingDisabled()) 483 399 return; 484 400 485 401 if (hRule == Image::StretchTile && vRule == Image::StretchTile) 486 402 // Just do a scale. 487 return drawImage(image, x, y, w, h, sx, sy, sw, sh, Image::CompositeSourceOver, context);488 489 image->scaleAndTileInRect( FloatRect(x, y, w, h), FloatRect(sx, sy, sw, sh), hRule, vRule, context);490 } 491 492 void GraphicsContext::fillRect( int x, int y, int w, int h, const Brush& brush)493 { 494 if ( m_data->state.paintingDisabled)403 return drawImage(image, dest, sx, sy, sw, sh, Image::CompositeSourceOver, context); 404 405 image->scaleAndTileInRect(dest, FloatRect(sx, sy, sw, sh), hRule, vRule, context); 406 } 407 408 void GraphicsContext::fillRect(const IntRect& rect, const Brush& brush) 409 { 410 if (paintingDisabled()) 495 411 return; 496 412 497 413 if (brush.style() == Brush::SolidPattern) 498 fillRectSourceOver(m_data->context, x, y, w, h, brush.color());414 fillRectSourceOver(m_data->context, rect, brush.color()); 499 415 } 500 416 … … 506 422 void GraphicsContext::addClip(const IntRect& rect) 507 423 { 508 if ( m_data->state.paintingDisabled)424 if (paintingDisabled()) 509 425 return; 510 426 … … 516 432 void GraphicsContext::setPaintingDisabled(bool f) 517 433 { 518 m_data->state.paintingDisabled= f;434 paintingDisabled() = f; 519 435 } 520 436 521 437 bool GraphicsContext::paintingDisabled() const 522 438 { 523 return m_data->state.paintingDisabled;439 return paintingDisabled(); 524 440 } 525 441 526 442 void GraphicsContext::drawFocusRing(const Color& color) 527 443 { 528 if ( m_data->state.paintingDisabled)444 if (paintingDisabled()) 529 445 return; 530 446 int radius = (m_focusRingWidth - 1) / 2; -
trunk/WebCore/platform/mac/GraphicsContextMac.mm
r13393 r13396 49 49 // exceptions for those. 50 50 51 struct GraphicsContextState { 52 GraphicsContextState() : paintingDisabled(false) { } 53 Font font; 54 Pen pen; 55 Brush brush; 56 bool paintingDisabled; 57 }; 58 59 struct GraphicsContextPrivate { 60 GraphicsContextPrivate(); 61 ~GraphicsContextPrivate(); 62 63 GraphicsContextState state; 64 Vector<GraphicsContextState> stack; 51 52 struct GraphicsContextPlatformPrivate { 53 GraphicsContextPlatformPrivate(); 54 ~GraphicsContextPlatformPrivate(); 55 65 56 id <WebCoreTextRenderer> textRenderer; 66 57 Font textRendererFont; … … 71 62 72 63 // A fillRect helper to work around the fact that NSRectFill uses copy mode, not source over. 73 static inline void fillRectSourceOver( float x, float y, float w, float h, const Color& col)64 static inline void fillRectSourceOver(const FloatRect& rect, const Color& col) 74 65 { 75 66 [nsColor(col) set]; 76 NSRectFillUsingOperation(NSMakeRect(x, y, w, h), NSCompositeSourceOver); 77 } 78 79 80 GraphicsContextPrivate::GraphicsContextPrivate() 67 NSRectFillUsingOperation(rect, NSCompositeSourceOver); 68 } 69 70 GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate() 81 71 : textRenderer(0) 82 72 { 83 73 } 84 74 85 GraphicsContextP rivate::~GraphicsContextPrivate()75 GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate() 86 76 { 87 77 KWQRelease(textRenderer); … … 89 79 90 80 GraphicsContext::GraphicsContext() 91 : m_data(new GraphicsContextPrivate) 92 , m_focusRingWidth(0) 93 , m_focusRingOffset(0) 94 , m_isForPrinting(false) 95 , m_usesInactiveTextBackgroundColor(false) 96 , m_updatingControlTints(false) 81 : m_common(createGraphicsContextPrivate()) 82 , m_data(new GraphicsContextPlatformPrivate) 97 83 { 98 84 } 99 85 100 86 GraphicsContext::GraphicsContext(bool forPrinting) 101 : m_data(new GraphicsContextPrivate) 102 , m_focusRingWidth(0) 103 , m_focusRingOffset(0) 104 , m_isForPrinting(forPrinting) 105 , m_usesInactiveTextBackgroundColor(false) 106 , m_updatingControlTints(false) 87 : m_common(createGraphicsContextPrivate(forPrinting)) 88 , m_data(new GraphicsContextPlatformPrivate) 107 89 { 108 90 } … … 110 92 GraphicsContext::~GraphicsContext() 111 93 { 94 destroyGraphicsContextPrivate(m_common); 112 95 delete m_data; 113 96 } 114 97 115 const Font& GraphicsContext::font() const 116 { 117 return m_data->state.font; 118 } 119 120 void GraphicsContext::setFont(const Font& aFont) 121 { 122 m_data->state.font = aFont; 123 } 124 125 const Pen& GraphicsContext::pen() const 126 { 127 return m_data->state.pen; 128 } 129 130 void GraphicsContext::setPen(const Pen& pen) 131 { 132 m_data->state.pen = pen; 133 } 134 135 void GraphicsContext::setPen(Pen::PenStyle style) 136 { 137 m_data->state.pen.setStyle(style); 138 m_data->state.pen.setColor(Color::black); 139 m_data->state.pen.setWidth(0); 140 } 141 142 void GraphicsContext::setPen(RGBA32 rgb) 143 { 144 m_data->state.pen.setStyle(Pen::SolidLine); 145 m_data->state.pen.setColor(rgb); 146 m_data->state.pen.setWidth(0); 147 } 148 149 void GraphicsContext::setBrush(const Brush& brush) 150 { 151 m_data->state.brush = brush; 152 } 153 154 void GraphicsContext::setBrush(Brush::BrushStyle style) 155 { 156 m_data->state.brush.setStyle(style); 157 m_data->state.brush.setColor(Color::black); 158 } 159 160 void GraphicsContext::setBrush(RGBA32 rgb) 161 { 162 m_data->state.brush.setStyle(Brush::SolidPattern); 163 m_data->state.brush.setColor(rgb); 164 } 165 166 const Brush& GraphicsContext::brush() const 167 { 168 return m_data->state.brush; 169 } 170 171 void GraphicsContext::save() 172 { 173 if (m_data->state.paintingDisabled) 174 return; 175 176 m_data->stack.append(m_data->state); 177 178 [NSGraphicsContext saveGraphicsState]; 179 } 180 181 void GraphicsContext::restore() 182 { 183 if (m_data->state.paintingDisabled) 184 return; 185 186 if (m_data->stack.isEmpty()) { 187 LOG_ERROR("ERROR void GraphicsContext::restore() stack is empty"); 188 return; 189 } 190 m_data->state = m_data->stack.last(); 191 m_data->stack.removeLast(); 192 98 void GraphicsContext::savePlatformState() 99 { 100 [NSGraphicsContext saveGraphicsState]; 101 } 102 103 void GraphicsContext::restorePlatformState() 104 { 193 105 [NSGraphicsContext restoreGraphicsState]; 194 106 } 195 107 196 108 // Draws a filled rectangle with a stroked border. 197 void GraphicsContext::drawRect( int x, int y, int w, int h)198 { 199 if ( m_data->state.paintingDisabled)109 void GraphicsContext::drawRect(const IntRect& rect) 110 { 111 if (paintingDisabled()) 200 112 return; 201 113 202 if ( m_data->state.brush.style() != Brush::NoBrush)203 fillRectSourceOver( x, y, w, h, m_data->state.brush.color());204 205 if ( m_data->state.pen.style() != Pen::Pen::NoPen) {114 if (brush().style() != Brush::NoBrush) 115 fillRectSourceOver(rect, brush().color()); 116 117 if (pen().style() != Pen::Pen::NoPen) { 206 118 setColorFromPen(); 207 NSFrameRect( NSMakeRect(x, y, w, h));119 NSFrameRect(rect); 208 120 } 209 121 } … … 211 123 void GraphicsContext::setColorFromBrush() 212 124 { 213 [nsColor( m_data->state.brush.color()) set];125 [nsColor(brush().color()) set]; 214 126 } 215 127 216 128 void GraphicsContext::setColorFromPen() 217 129 { 218 [nsColor( m_data->state.pen.color()) set];130 [nsColor(pen().color()) set]; 219 131 } 220 132 221 133 // This is only used to draw borders. 222 void GraphicsContext::drawLine( int x1, int y1, int x2, int y2)223 { 224 if ( m_data->state.paintingDisabled)225 return; 226 227 Pen::PenStyle penStyle = m_data->state.pen.style();134 void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) 135 { 136 if (paintingDisabled()) 137 return; 138 139 Pen::PenStyle penStyle = pen().style(); 228 140 if (penStyle == Pen::Pen::NoPen) 229 141 return; 230 float width = m_data->state.pen.width();142 float width = pen().width(); 231 143 if (width < 1) 232 144 width = 1; 233 145 234 NSPoint p1 = NSMakePoint(x1, y1); 235 NSPoint p2 = NSMakePoint(x2, y2); 146 NSPoint p1 = point1; 147 NSPoint p2 = point2; 148 bool isVerticalLine = (p1.x == p2.x); 236 149 237 150 // For odd widths, we add in 0.5 to the appropriate x/y so that the float arithmetic … … 240 153 // us a perfect position, but an odd width gave us a position that is off by exactly 0.5. 241 154 if (penStyle == Pen::DotLine || penStyle == Pen::DashLine) { 242 if ( x1 == x2) {155 if (isVerticalLine) { 243 156 p1.y += width; 244 157 p2.y -= width; 245 } 246 else { 158 } else { 247 159 p1.x += width; 248 160 p2.x -= width; … … 251 163 252 164 if (((int)width)%2) { 253 if ( x1 == x2) {165 if (isVerticalLine) { 254 166 // We're a vertical line. Adjust our x. 255 167 p1.x += 0.5; 256 168 p2.x += 0.5; 257 } 258 else { 169 } else { 259 170 // We're a horizontal line. Adjust our y. 260 171 p1.y += 0.5; … … 288 199 // Do a rect fill of our endpoints. This ensures we always have the 289 200 // appearance of being a border. We then draw the actual dotted/dashed line. 290 if (x1 == x2) { 291 fillRectSourceOver(p1.x-width/2, p1.y-width, width, width, m_data->state.pen.color()); 292 fillRectSourceOver(p2.x-width/2, p2.y, width, width, m_data->state.pen.color()); 201 const Color& penColor = pen().color(); 202 if (isVerticalLine) { 203 fillRectSourceOver(FloatRect(p1.x-width/2, p1.y-width, width, width), penColor); 204 fillRectSourceOver(FloatRect(p2.x-width/2, p2.y, width, width), penColor); 293 205 } else { 294 fillRectSourceOver( p1.x-width, p1.y-width/2, width, width, m_data->state.pen.color());295 fillRectSourceOver( p2.x, p2.y-width/2, width, width, m_data->state.pen.color());206 fillRectSourceOver(FloatRect(p1.x-width, p1.y-width/2, width, width), penColor); 207 fillRectSourceOver(FloatRect(p2.x, p2.y-width/2, width, width), penColor); 296 208 } 297 209 … … 299 211 // Remainder is 20. The maximum pixels of line we could paint 300 212 // will be 50 pixels. 301 int distance = ( (x1 == x2) ? (y2 - y1) : (x2 - x1)) - 2*(int)width;213 int distance = (isVerticalLine ? (int)(p2.y - p1.y) : (int)(p2.x - p1.x)) - 2*(int)width; 302 214 int remainder = distance%patWidth; 303 215 int coverage = distance-remainder; … … 342 254 343 255 // This method is only used to draw the little circles used in lists. 344 void GraphicsContext::drawEllipse( int x, int y, int w, int h)256 void GraphicsContext::drawEllipse(const IntRect& rect) 345 257 { 346 258 // FIXME: CG added CGContextAddEllipseinRect in Tiger, so we should be able to quite easily draw an ellipse. 347 259 // This code can only handle circles, not ellipses. But khtml only 348 260 // uses it for circles. 349 ASSERT( w == h);350 351 if ( m_data->state.paintingDisabled)261 ASSERT(rect.width() == rect.height()); 262 263 if (paintingDisabled()) 352 264 return; 353 265 354 266 CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; 355 267 CGContextBeginPath(context); 356 float r = (float) w/ 2;357 CGContextAddArc(context, x + r, y+ r, r, 0, 2*M_PI, true);268 float r = (float)rect.width() / 2; 269 CGContextAddArc(context, rect.x() + r, rect.y() + r, r, 0, 2*M_PI, true); 358 270 CGContextClosePath(context); 359 271 360 if ( m_data->state.brush.style() != Brush::NoBrush) {272 if (brush().style() != Brush::NoBrush) { 361 273 setColorFromBrush(); 362 if ( m_data->state.pen.style() != Pen::NoPen) {274 if (pen().style() != Pen::NoPen) { 363 275 // stroke and fill 364 276 setColorFromPen(); 365 unsigned penWidth = m_data->state.pen.width();277 unsigned penWidth = pen().width(); 366 278 if (penWidth == 0) 367 279 penWidth++; 368 280 CGContextSetLineWidth(context, penWidth); 369 281 CGContextDrawPath(context, kCGPathFillStroke); 370 } else {282 } else 371 283 CGContextFillPath(context); 372 } 373 } 374 if (m_data->state.pen.style() != Pen::NoPen) { 284 } 285 if (pen().style() != Pen::NoPen) { 375 286 setColorFromPen(); 376 unsigned penWidth = m_data->state.pen.width();287 unsigned penWidth = pen().width(); 377 288 if (penWidth == 0) 378 289 penWidth++; … … 383 294 384 295 385 void GraphicsContext::drawArc 296 void GraphicsContext::drawArc(int x, int y, int w, int h, int a, int alen) 386 297 { 387 298 // Only supports arc on circles. That's all khtml needs. 388 299 ASSERT(w == h); 389 300 390 if ( m_data->state.paintingDisabled)391 return; 392 393 if ( m_data->state.pen.style() != Pen::NoPen) {301 if (paintingDisabled()) 302 return; 303 304 if (pen().style() != Pen::NoPen) { 394 305 CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; 395 306 CGContextBeginPath(context); … … 401 312 402 313 setColorFromPen(); 403 CGContextSetLineWidth(context, m_data->state.pen.width());314 CGContextSetLineWidth(context, pen().width()); 404 315 CGContextStrokePath(context); 405 316 } … … 408 319 void GraphicsContext::drawConvexPolygon(const IntPointArray& points) 409 320 { 410 if ( m_data->state.paintingDisabled)321 if (paintingDisabled()) 411 322 return; 412 323 … … 427 338 CGContextClosePath(context); 428 339 429 if ( m_data->state.brush.style() != Brush::NoBrush) {340 if (brush().style() != Brush::NoBrush) { 430 341 setColorFromBrush(); 431 342 CGContextEOFillPath(context); 432 343 } 433 344 434 if ( m_data->state.pen.style() != Pen::NoPen) {345 if (pen().style() != Pen::NoPen) { 435 346 setColorFromPen(); 436 CGContextSetLineWidth(context, m_data->state.pen.width());347 CGContextSetLineWidth(context, pen().width()); 437 348 CGContextStrokePath(context); 438 349 } … … 456 367 } 457 368 458 void GraphicsContext::draw FloatImage(Image* image, float x, float y, float w, float h,369 void GraphicsContext::drawImage(Image* image, const FloatRect& dest, 459 370 float sx, float sy, float sw, float sh, Image::CompositeOperator compositeOperator, void* context) 460 371 { 461 if ( m_data->state.paintingDisabled)372 if (paintingDisabled()) 462 373 return; 463 374 464 375 float tsw = sw; 465 376 float tsh = sh; 466 float tw = w;467 float th = h;377 float tw = dest.width(); 378 float th = dest.height(); 468 379 469 380 if (tsw == -1) … … 477 388 th = image->height(); 478 389 479 image->drawInRect(FloatRect( x, y, tw, th), FloatRect(sx, sy, tsw, tsh), compositeOperator, context);480 } 481 482 void GraphicsContext::drawTiledImage(Image* image, int x, int y, int w, int h, int sx, int sy, void* context)483 { 484 if ( m_data->state.paintingDisabled)485 return; 486 487 image->tileInRect( FloatRect(x, y, w, h), FloatPoint(sx, sy), context);488 } 489 490 void GraphicsContext::drawScaledAndTiledImage(Image* image, int x, int y, int w, int h, int sx, int sy, int sw, int sh,390 image->drawInRect(FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(sx, sy, tsw, tsh), compositeOperator, context); 391 } 392 393 void GraphicsContext::drawTiledImage(Image* image, const IntRect& rect, int sx, int sy, void* context) 394 { 395 if (paintingDisabled()) 396 return; 397 398 image->tileInRect(rect, FloatPoint(sx, sy), context); 399 } 400 401 void GraphicsContext::drawScaledAndTiledImage(Image* image, const IntRect& dest, int sx, int sy, int sw, int sh, 491 402 Image::TileRule hRule, Image::TileRule vRule, void* context) 492 403 { 493 if ( m_data->state.paintingDisabled)404 if (paintingDisabled()) 494 405 return; 495 406 496 407 if (hRule == Image::StretchTile && vRule == Image::StretchTile) 497 408 // Just do a scale. 498 return drawImage(image, x, y, w, h, sx, sy, sw, sh, Image::CompositeSourceOver, context);499 500 image->scaleAndTileInRect( FloatRect(x, y, w, h), FloatRect(sx, sy, sw, sh), hRule, vRule, context);409 return drawImage(image, dest, sx, sy, sw, sh, Image::CompositeSourceOver, context); 410 411 image->scaleAndTileInRect(dest, FloatRect(sx, sy, sw, sh), hRule, vRule, context); 501 412 } 502 413 … … 512 423 Color GraphicsContext::selectedTextBackgroundColor() const 513 424 { 514 NSColor *color = m_usesInactiveTextBackgroundColor? [NSColor secondarySelectedControlColor] : [NSColor selectedTextBackgroundColor];425 NSColor *color = usesInactiveTextBackgroundColor() ? [NSColor secondarySelectedControlColor] : [NSColor selectedTextBackgroundColor]; 515 426 // this needs to always use device colorspace so it can de-calibrate the color for 516 427 // Color to possibly recalibrate it … … 530 441 } 531 442 532 void GraphicsContext::fillRect( int x, int y, int w, int h, const Brush& brush)533 { 534 if ( m_data->state.paintingDisabled)443 void GraphicsContext::fillRect(const IntRect& rect, const Brush& brush) 444 { 445 if (paintingDisabled()) 535 446 return; 536 447 537 448 if (brush.style() == Brush::SolidPattern) 538 fillRectSourceOver(x, y, w, h, brush.color()); 539 } 540 541 void GraphicsContext::fillRect(const IntRect& rect, const Brush& brush) 542 { 543 fillRect(rect.x(), rect.y(), rect.width(), rect.height(), brush); 449 fillRectSourceOver(rect, brush.color()); 544 450 } 545 451 546 452 void GraphicsContext::addClip(const IntRect& rect) 547 453 { 548 if ( m_data->state.paintingDisabled)454 if (paintingDisabled()) 549 455 return; 550 456 … … 555 461 const IntSize& bottomLeft, const IntSize& bottomRight) 556 462 { 557 if ( m_data->state.paintingDisabled)463 if (paintingDisabled()) 558 464 return; 559 465 … … 606 512 } 607 513 608 void GraphicsContext::setPaintingDisabled(bool f)609 {610 m_data->state.paintingDisabled = f;611 }612 613 bool GraphicsContext::paintingDisabled() const614 {615 return m_data->state.paintingDisabled;616 }617 618 514 CGContextRef GraphicsContext::currentCGContext() 619 515 { … … 630 526 void GraphicsContext::beginTransparencyLayer(float opacity) 631 527 { 632 if ( m_data->state.paintingDisabled)528 if (paintingDisabled()) 633 529 return; 634 530 CGContextRef context = currentCGContext(); … … 640 536 void GraphicsContext::endTransparencyLayer() 641 537 { 642 if ( m_data->state.paintingDisabled)538 if (paintingDisabled()) 643 539 return; 644 540 CGContextRef context = currentCGContext(); … … 649 545 void GraphicsContext::setShadow(int x, int y, int blur, const Color& color) 650 546 { 651 if ( m_data->state.paintingDisabled)547 if (paintingDisabled()) 652 548 return; 653 549 // Check for an invalid color, as this means that the color was not set for the shadow … … 668 564 void GraphicsContext::clearShadow() 669 565 { 670 if ( m_data->state.paintingDisabled)566 if (paintingDisabled()) 671 567 return; 672 568 CGContextRef context = currentCGContext(); … … 676 572 void GraphicsContext::drawFocusRing(const Color& color) 677 573 { 678 if ( m_data->state.paintingDisabled)679 return; 680 int radius = ( m_focusRingWidth- 1) / 2;681 int offset = radius + m_focusRingOffset;574 if (paintingDisabled()) 575 return; 576 int radius = (focusRingWidth() - 1) / 2; 577 int offset = radius + focusRingOffset(); 682 578 CGColorRef colorRef = color.isValid() ? cgColor(color) : 0; 683 579 684 580 CGMutablePathRef focusRingPath = CGPathCreateMutable(); 685 unsigned rectCount = m_focusRingRects.size(); 581 const Vector<IntRect>& rects = focusRingRects(); 582 unsigned rectCount = rects.size(); 686 583 687 584 for (unsigned i = 0; i < rectCount; i++) 688 CGPathAddRect(focusRingPath, 0, CGRectInset( m_focusRingRects[i], -offset, -offset));585 CGPathAddRect(focusRingPath, 0, CGRectInset(rects[i], -offset, -offset)); 689 586 690 587 [[WebCoreGraphicsBridge sharedBridge] drawFocusRingWithPath:focusRingPath radius:radius color:colorRef]; -
trunk/WebCore/rendering/RenderBox.cpp
r13393 r13396 432 432 // Paint the color first underneath all images. 433 433 if (!bgLayer->next() && bgColor.isValid() && bgColor.alpha() > 0) { 434 IntRect rect(_tx, clipy, w, cliph); 434 435 // If we have an alpha and we are painting the root element, go ahead and blend with white. 435 436 if (bgColor.alpha() < 0xFF && isRoot() && !canvas()->view()->isTransparent()) 436 p->fillRect( _tx, clipy, w, cliph, Color(Color::white));437 p->fillRect( _tx, clipy, w, cliph, bgColor);437 p->fillRect(rect, Color(Color::white)); 438 p->fillRect(rect, bgColor); 438 439 } 439 440 … … 568 569 569 570 if (cw>0 && ch>0) 570 p->drawTiledImage(bg->image(), cx, cy, cw, ch, sx, sy);571 p->drawTiledImage(bg->image(), IntRect(cx, cy, cw, ch), sx, sy); 571 572 } 572 573 … … 578 579 } 579 580 580 void RenderBox::outlineBox(GraphicsContext* p, int _tx, int _ty, const char *color)581 void RenderBox::outlineBox(GraphicsContext* p, int _tx, int _ty, const char* color) 581 582 { 582 583 p->setPen(Pen(Color(color), 1, Pen::DotLine)); 583 584 p->setBrush(WebCore::Brush::NoBrush); 584 p->drawRect( _tx, _ty, m_width, m_height);585 p->drawRect(IntRect(_tx, _ty, m_width, m_height)); 585 586 } 586 587 -
trunk/WebCore/rendering/RenderImage.cpp
r13393 r13396 190 190 bool drawSelectionTint = isSelected() && !isPrinting; 191 191 if (i.phase == PaintActionSelection) { 192 if (selectionState() == SelectionNone) {192 if (selectionState() == SelectionNone) 193 193 return; 194 }195 194 drawSelectionTint = false; 196 195 } … … 214 213 p->setPen (Color::lightGray); 215 214 p->setBrush (WebCore::Brush::NoBrush); 216 p->drawRect ( _tx + leftBorder + leftPad, _ty + topBorder + topPad, cWidth, cHeight);215 p->drawRect (IntRect(_tx + leftBorder + leftPad, _ty + topBorder + topPad, cWidth, cHeight)); 217 216 } 218 217 -
trunk/WebCore/rendering/RenderObject.cpp
r13393 r13396 829 829 case BSBottom: 830 830 case BSTop: 831 p->drawLine( x1, (y1+y2)/2, x2, (y1+y2)/2);831 p->drawLine(IntPoint(x1, (y1+y2)/2), IntPoint(x2, (y1+y2)/2)); 832 832 break; 833 833 case BSRight: 834 834 case BSLeft: 835 p->drawLine( (x1+x2)/2, y1, (x1+x2)/2, y2);835 p->drawLine(IntPoint((x1+x2)/2, y1), IntPoint((x1+x2)/2, y2)); 836 836 break; 837 837 } … … 851 851 case BSTop: 852 852 case BSBottom: 853 p->drawRect( x1, y1 , x2-x1, third);854 p->drawRect( x1, y2-third, x2-x1, third);853 p->drawRect(IntRect(x1, y1 , x2-x1, third)); 854 p->drawRect(IntRect(x1, y2-third, x2-x1, third)); 855 855 break; 856 856 case BSLeft: 857 p->drawRect( x1 , y1+1, third, y2-y1-1);858 p->drawRect( x2-third, y1+1, third, y2-y1-1);857 p->drawRect(IntRect(x1 , y1+1, third, y2-y1-1)); 858 p->drawRect(IntRect(x2-third, y1+1, third, y2-y1-1)); 859 859 break; 860 860 case BSRight: 861 p->drawRect( x1 , y1+1, third, y2-y1-1);862 p->drawRect( x2-third, y1+1, third, y2-y1-1);861 p->drawRect(IntRect(x1 , y1+1, third, y2-y1-1)); 862 p->drawRect(IntRect(x2-third, y1+1, third, y2-y1-1)); 863 863 break; 864 864 } … … 867 867 { 868 868 int adjbw1bigthird; 869 if (adjbw1>0) adjbw1bigthird = adjbw1+1; 870 else adjbw1bigthird = adjbw1 - 1; 869 if (adjbw1>0) 870 adjbw1bigthird = adjbw1+1; 871 else 872 adjbw1bigthird = adjbw1 - 1; 871 873 adjbw1bigthird /= 3; 872 874 873 875 int adjbw2bigthird; 874 if (adjbw2>0) adjbw2bigthird = adjbw2 + 1; 875 else adjbw2bigthird = adjbw2 - 1; 876 if (adjbw2>0) 877 adjbw2bigthird = adjbw2 + 1; 878 else 879 adjbw2bigthird = adjbw2 - 1; 876 880 adjbw2bigthird /= 3; 877 881 … … 962 966 ASSERT(x2 >= x1); 963 967 ASSERT(y2 >= y1); 964 if (adjbw1==0 && adjbw2 == 0) 965 { 966 p->drawRect(x1,y1,x2-x1,y2-y1); 968 if (adjbw1==0 && adjbw2 == 0) { 969 p->drawRect(IntRect(x1,y1,x2-x1,y2-y1)); 967 970 return; 968 971 } 969 972 switch(s) { 970 973 case BSTop: … … 1043 1046 // The rect to use from within the image is obtained from our slice, and is (0, 0, leftSlice, topSlice) 1044 1047 if (drawTop) 1045 p->drawImage(borderImage->image(), _tx, _ty, style->borderLeftWidth(), style->borderTopWidth(),1048 p->drawImage(borderImage->image(), IntRect(_tx, _ty, style->borderLeftWidth(), style->borderTopWidth()), 1046 1049 0, 0, leftSlice, topSlice); 1047 1050 … … 1049 1052 // The rect to use from within the image is (0, imageHeight - bottomSlice, leftSlice, botomSlice) 1050 1053 if (drawBottom) 1051 p->drawImage(borderImage->image(), _tx, _ty + h - style->borderBottomWidth(), style->borderLeftWidth(), style->borderBottomWidth(),1054 p->drawImage(borderImage->image(), IntRect(_tx, _ty + h - style->borderBottomWidth(), style->borderLeftWidth(), style->borderBottomWidth()), 1052 1055 0, imageHeight - bottomSlice, leftSlice, bottomSlice); 1053 1056 1054 1057 // Paint the left edge. 1055 1058 // Have to scale and tile into the border rect. 1056 p->drawScaledAndTiledImage(borderImage->image(), _tx, _ty + style->borderTopWidth(), style->borderLeftWidth(),1057 h - style->borderTopWidth() - style->borderBottomWidth() ,1059 p->drawScaledAndTiledImage(borderImage->image(), IntRect(_tx, _ty + style->borderTopWidth(), style->borderLeftWidth(), 1060 h - style->borderTopWidth() - style->borderBottomWidth()), 1058 1061 0, topSlice, leftSlice, imageHeight - topSlice - bottomSlice, 1059 1062 Image::StretchTile, (Image::TileRule)vRule); … … 1065 1068 // The rect to use from within the image is obtained from our slice, and is (imageWidth - rightSlice, 0, rightSlice, topSlice) 1066 1069 if (drawTop) 1067 p->drawImage(borderImage->image(), _tx + w - style->borderRightWidth(), _ty, style->borderRightWidth(), style->borderTopWidth(),1070 p->drawImage(borderImage->image(), IntRect(_tx + w - style->borderRightWidth(), _ty, style->borderRightWidth(), style->borderTopWidth()), 1068 1071 imageWidth - rightSlice, 0, rightSlice, topSlice); 1069 1072 … … 1071 1074 // The rect to use from within the image is (imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, botomSlice) 1072 1075 if (drawBottom) 1073 p->drawImage(borderImage->image(), _tx + w - style->borderRightWidth(), _ty + h - style->borderBottomWidth(), style->borderRightWidth(), style->borderBottomWidth(),1076 p->drawImage(borderImage->image(), IntRect(_tx + w - style->borderRightWidth(), _ty + h - style->borderBottomWidth(), style->borderRightWidth(), style->borderBottomWidth()), 1074 1077 imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice); 1075 1078 1076 1079 // Paint the right edge. 1077 p->drawScaledAndTiledImage(borderImage->image(), _tx + w - style->borderRightWidth(), _ty + style->borderTopWidth(), style->borderRightWidth(),1078 h - style->borderTopWidth() - style->borderBottomWidth() ,1080 p->drawScaledAndTiledImage(borderImage->image(), IntRect(_tx + w - style->borderRightWidth(), _ty + style->borderTopWidth(), style->borderRightWidth(), 1081 h - style->borderTopWidth() - style->borderBottomWidth()), 1079 1082 imageWidth - rightSlice, topSlice, rightSlice, imageHeight - topSlice - bottomSlice, 1080 1083 Image::StretchTile, (Image::TileRule)vRule); … … 1083 1086 // Paint the top edge. 1084 1087 if (drawTop) 1085 p->drawScaledAndTiledImage(borderImage->image(), _tx + style->borderLeftWidth(), _ty, w - style->borderLeftWidth() - style->borderRightWidth(), 1086 style->borderTopWidth(), 1088 p->drawScaledAndTiledImage(borderImage->image(), IntRect(_tx + style->borderLeftWidth(), _ty, w - style->borderLeftWidth() - style->borderRightWidth(), style->borderTopWidth()), 1087 1089 leftSlice, 0, imageWidth - rightSlice - leftSlice, topSlice, 1088 1090 (Image::TileRule)hRule, Image::StretchTile); … … 1090 1092 // Paint the bottom edge. 1091 1093 if (drawBottom) 1092 p->drawScaledAndTiledImage(borderImage->image(), _tx + style->borderLeftWidth(), _ty + h - style->borderBottomWidth(), 1093 w - style->borderLeftWidth() - style->borderRightWidth(), 1094 style->borderBottomWidth(), 1094 p->drawScaledAndTiledImage(borderImage->image(), IntRect(_tx + style->borderLeftWidth(), _ty + h - style->borderBottomWidth(), 1095 w - style->borderLeftWidth() - style->borderRightWidth(), style->borderBottomWidth()), 1095 1096 leftSlice, imageHeight - bottomSlice, imageWidth - rightSlice - leftSlice, bottomSlice, 1096 1097 (Image::TileRule)hRule, Image::StretchTile); … … 1098 1099 // Paint the middle. 1099 1100 if (drawMiddle) 1100 p->drawScaledAndTiledImage(borderImage->image(), _tx + style->borderLeftWidth(), _ty + style->borderTopWidth(), w - style->borderLeftWidth() - style->borderRightWidth(),1101 h - style->borderTopWidth() - style->borderBottomWidth() ,1101 p->drawScaledAndTiledImage(borderImage->image(), IntRect(_tx + style->borderLeftWidth(), _ty + style->borderTopWidth(), w - style->borderLeftWidth() - style->borderRightWidth(), 1102 h - style->borderTopWidth() - style->borderBottomWidth()), 1102 1103 leftSlice, topSlice, imageWidth - rightSlice - leftSlice, imageHeight - topSlice - bottomSlice, 1103 1104 (Image::TileRule)hRule, (Image::TileRule)vRule); -
trunk/WebCore/rendering/render_frames.cpp
r13393 r13396 516 516 paint.setBrush(Color::gray); 517 517 v->setDrawingAlpha(0.25); 518 paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height());518 paint.drawRect(IntRect(p + sw/2 - rBord, r.y(), 2 * rBord, r.height())); 519 519 v->setDrawingAlpha(1.0); 520 520 } 521 521 } else { 522 522 if (m_oldpos >= 0) 523 v->updateContents(IntRect(r.x(), m_oldpos + sw/2 - rBord, r.width(), 2 *rBord), true);523 v->updateContents(IntRect(r.x(), m_oldpos + sw/2 - rBord, r.width(), 2 * rBord), true); 524 524 if (p >= 0) { 525 525 paint.setPen(Pen::NoPen); 526 526 paint.setBrush(Color::gray); 527 527 v->setDrawingAlpha(0.25); 528 paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2 * rBord);528 paint.drawRect(IntRect(r.x(), p + sw/2 - rBord, r.width(), 2 * rBord)); 529 529 v->setDrawingAlpha(1.0); 530 530 } -
trunk/WebCore/rendering/render_list.cpp
r13393 r13396 431 431 case DISC: 432 432 p->setBrush(color); 433 p->drawEllipse(marker .x(), marker.y(), marker.width(), marker.height());433 p->drawEllipse(marker); 434 434 return; 435 435 case CIRCLE: 436 436 p->setBrush(WebCore::Brush::NoBrush); 437 p->drawEllipse(marker .x(), marker.y(), marker.width(), marker.height());437 p->drawEllipse(marker); 438 438 return; 439 439 case SQUARE: 440 440 p->setBrush(color); 441 p->drawRect(marker .x(), marker.y(), marker.width(), marker.height());441 p->drawRect(marker); 442 442 return; 443 443 case LNONE:
Note: See TracChangeset
for help on using the changeset viewer.