Changeset 47341 in webkit
- Timestamp:
- Aug 16, 2009 3:57:30 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r47340 r47341 1 2009-08-16 David Kilzer <ddkilzer@apple.com> 2 3 <http://webkit.org/b/28355> Replace MAX()/MIN() macros with type-safe std::max()/min() templates 4 5 Reviewed by Dan Bernstein. 6 7 * accessibility/mac/AccessibilityObjectWrapper.mm: 8 (AXAttributeStringSetSpelling): Changed MIN() to min(). 9 * platform/graphics/mac/FontMacATSUI.mm: 10 (WebCore::Font::selectionRectForComplexText): Changed MAX() to 11 max() and MIN() to min(). 12 (WebCore::Font::floatWidthForComplexText): Ditto. 13 * platform/graphics/mac/SimpleFontDataMac.mm: Added using 14 std::max statement. 15 (WebCore::SimpleFontData::platformInit): Changed MAX() to max(). 16 * platform/text/mac/TextCodecMac.cpp: 17 (WebCore::TextCodecMac::decode): Changed MIN() to min(). 18 1 19 2009-08-16 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com> 2 20 -
trunk/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
r47140 r47341 379 379 // add misspelling attribute for the intersection of the marker and the range 380 380 int rStart = range.location + (marker.startOffset - offset); 381 int rLength = MIN(marker.endOffset, endOffset) - marker.startOffset;381 int rLength = min(marker.endOffset, endOffset) - marker.startOffset; 382 382 NSRange spellRange = NSMakeRange(rStart, rLength); 383 383 AXAttributeStringSetNumber(attrString, NSAccessibilityMisspelledTextAttribute, [NSNumber numberWithBool:YES], spellRange); -
trunk/WebCore/platform/graphics/mac/FontMacATSUI.mm
r44439 r47341 505 505 } 506 506 507 float beforeWidth = MIN(FixedToFloat(firstGlyphBounds.lowerLeft.x), FixedToFloat(firstGlyphBounds.upperLeft.x));508 float afterWidth = MAX(FixedToFloat(firstGlyphBounds.lowerRight.x), FixedToFloat(firstGlyphBounds.upperRight.x));507 float beforeWidth = min(FixedToFloat(firstGlyphBounds.lowerLeft.x), FixedToFloat(firstGlyphBounds.upperLeft.x)); 508 float afterWidth = max(FixedToFloat(firstGlyphBounds.lowerRight.x), FixedToFloat(firstGlyphBounds.upperRight.x)); 509 509 510 510 FloatRect rect(point.x() + floorf(beforeWidth), point.y(), roundf(afterWidth) - floorf(beforeWidth), h); … … 592 592 LOG_ERROR("unexpected result from ATSUGetGlyphBounds(): actualNumBounds(%d) != 1", actualNumBounds); 593 593 594 return MAX(FixedToFloat(firstGlyphBounds.upperRight.x), FixedToFloat(firstGlyphBounds.lowerRight.x)) -595 MIN(FixedToFloat(firstGlyphBounds.upperLeft.x), FixedToFloat(firstGlyphBounds.lowerLeft.x));594 return max(FixedToFloat(firstGlyphBounds.upperRight.x), FixedToFloat(firstGlyphBounds.lowerRight.x)) - 595 min(FixedToFloat(firstGlyphBounds.upperLeft.x), FixedToFloat(firstGlyphBounds.lowerLeft.x)); 596 596 } 597 597 -
trunk/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
r44444 r47341 51 51 @end 52 52 53 using namespace std; 54 53 55 namespace WebCore { 54 56 … … 270 272 // poorly if we return an accurate height. Classic case is Times 13 point, 271 273 // which has an "x" that is 7x6 pixels. 272 m_xHeight = MAX(NSMaxX(xBox), NSMaxY(xBox));274 m_xHeight = max(NSMaxX(xBox), NSMaxY(xBox)); 273 275 } else 274 276 m_xHeight = [m_platformData.font() xHeight]; -
trunk/WebCore/platform/text/mac/TextCodecMac.cpp
r44096 r47341 37 37 #include <wtf/Threading.h> 38 38 39 using std::min;39 using namespace std; 40 40 41 41 namespace WebCore { … … 142 142 ASSERT(m_numBufferedBytes < sizeof(m_bufferedBytes)); 143 143 const int spaceInBuffer = sizeof(m_bufferedBytes) - m_numBufferedBytes; 144 const int bytesToPutInBuffer = MIN(spaceInBuffer, inputBufferLength);144 const int bytesToPutInBuffer = min(spaceInBuffer, inputBufferLength); 145 145 ASSERT(bytesToPutInBuffer != 0); 146 146 memcpy(m_bufferedBytes + m_numBufferedBytes, inputBuffer, bytesToPutInBuffer); -
trunk/WebKit/mac/ChangeLog
r47323 r47341 1 2009-08-16 David Kilzer <ddkilzer@apple.com> 2 3 <http://webkit.org/b/28355> Replace MAX()/MIN() macros with type-safe std::max()/min() templates 4 5 Reviewed by Dan Bernstein. 6 7 * Plugins/WebBaseNetscapePluginStream.mm: Added using std::min 8 statement. 9 (WebNetscapePluginStream::deliverData): Changed MIN() to min(). 10 Changed C-style cast to a static_cast. 11 * Plugins/WebNetscapePluginView.mm: Added using std::min 12 statement. 13 (-[WebNetscapePluginView _postURL:target:len:buf:file:notifyData:sendNotification:allowHeaders:]): 14 Changed MIN() to min(). Changed C-style cast to a static_cast. 15 * WebView/WebHTMLView.mm: Added using std::max statement. 16 (-[WebHTMLView _dragImageForURL:withLabel:]): Changed MAX() to 17 max(). 18 (-[WebHTMLView _scaleFactorForPrintOperation:]): Ditto. 19 * WebView/WebTextCompletionController.mm: Added using std::max 20 and using std::min statements. 21 (-[WebTextCompletionController _placePopupWindow:]): Changed 22 type of maxWidth variable from float to CGFloat to prevent a 23 type mismatch on x86_64. Changed MAX() to max() and MIN() to 24 min(). Added static_cast for a constant value since CGFloat is 25 defined as a float on i386 and as a double on x86_64. 26 1 27 2009-08-15 Adam Bergkvist <adam.bergkvist@ericsson.com> 2 28 -
trunk/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm
r46431 r47341 50 50 51 51 using namespace WebCore; 52 using namespace std; 52 53 53 54 #define WEB_REASON_NONE -1 … … 523 524 break; 524 525 } else { 525 deliveryBytes = MIN(deliveryBytes, totalBytes - totalBytesDelivered);526 deliveryBytes = min(deliveryBytes, totalBytes - totalBytesDelivered); 526 527 NSData *subdata = [m_deliveryData.get() subdataWithRange:NSMakeRange(totalBytesDelivered, deliveryBytes)]; 527 528 PluginStopDeferrer deferrer(m_pluginView.get()); … … 532 533 return; 533 534 } 534 deliveryBytes = MIN((unsigned)deliveryBytes, [subdata length]);535 deliveryBytes = min<int32>(deliveryBytes, [subdata length]); 535 536 m_offset += deliveryBytes; 536 537 totalBytesDelivered += deliveryBytes; -
trunk/WebKit/mac/Plugins/WebNetscapePluginView.mm
r46866 r47341 79 79 #import <objc/objc-runtime.h> 80 80 81 using std::max;82 83 81 #define LoginWindowDidSwitchFromUserNotification @"WebLoginWindowDidSwitchFromUserNotification" 84 82 #define LoginWindowDidSwitchToUserNotification @"WebLoginWindowDidSwitchToUserNotification" … … 86 84 using namespace WebCore; 87 85 using namespace WebKit; 86 using namespace std; 88 87 89 88 static inline bool isDrawingModelQuickDraw(NPDrawingModel drawingModel) … … 1795 1794 1796 1795 if (contentLength != nil) 1797 dataLength = MIN((unsigned)[contentLength intValue], dataLength);1796 dataLength = min<unsigned>([contentLength intValue], dataLength); 1798 1797 [header removeObjectForKey:@"Content-Length"]; 1799 1798 -
trunk/WebKit/mac/WebView/WebHTMLView.mm
r46949 r47341 126 126 using namespace HTMLNames; 127 127 using namespace WTF; 128 using namespace std; 128 129 129 130 @interface NSWindow (BorderViewAccess) … … 1650 1651 imageSize.height += urlStringSize.height; 1651 1652 if (urlStringSize.width > MAX_DRAG_LABEL_WIDTH) { 1652 imageSize.width = MAX(MAX_DRAG_LABEL_WIDTH + DRAG_LABEL_BORDER_X * 2.0f, MIN_DRAG_LABEL_WIDTH_BEFORE_CLIP);1653 imageSize.width = max(MAX_DRAG_LABEL_WIDTH + DRAG_LABEL_BORDER_X * 2, MIN_DRAG_LABEL_WIDTH_BEFORE_CLIP); 1653 1654 clipURLString = YES; 1654 1655 } else { 1655 imageSize.width = MAX(labelSize.width + DRAG_LABEL_BORDER_X * 2.0f, urlStringSize.width + DRAG_LABEL_BORDER_X * 2.0f);1656 imageSize.width = max(labelSize.width + DRAG_LABEL_BORDER_X * 2, urlStringSize.width + DRAG_LABEL_BORDER_X * 2); 1656 1657 } 1657 1658 } … … 3716 3717 // If the new bottom is equal to the old bottom (when both are treated as floats), we just copy 3717 3718 // oldBottom over to newBottom. This prevents rounding errors that can occur when converting newBottomFloat to a double. 3718 if (fabs((float)oldBottom - newBottomFloat) <= std::numeric_limits<float>::epsilon())3719 if (fabs((float)oldBottom - newBottomFloat) <= numeric_limits<float>::epsilon()) 3719 3720 *newBottom = oldBottom; 3720 3721 else … … 3751 3752 float shrinkToFitScaleFactor = [self _availablePaperWidthForPrintOperation:printOperation]/viewWidth; 3752 3753 float shrinkToAvoidOrphan = _private->avoidingPrintOrphan ? (1.0f / PrintingOrphanShrinkAdjustment) : 1.0f; 3753 return userScaleFactor * MAX(maxShrinkToFitScaleFactor, shrinkToFitScaleFactor) * shrinkToAvoidOrphan;3754 return userScaleFactor * max(maxShrinkToFitScaleFactor, shrinkToFitScaleFactor) * shrinkToAvoidOrphan; 3754 3755 } 3755 3756 -
trunk/WebKit/mac/WebView/WebTextCompletionController.mm
r44316 r47341 40 40 41 41 using namespace WebCore; 42 using namespace std; 42 43 43 44 // This class handles the complete: operation. … … 132 133 windowFrame.origin.y -= windowFrame.size.height; 133 134 NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSFont systemFontOfSize:12.0f], NSFontAttributeName, nil]; 134 float maxWidth = 0.0f;135 CGFloat maxWidth = 0; 135 136 int maxIndex = -1; 136 137 int i; … … 147 148 maxWidth = ceilf([NSWindow frameRectForContentRect:NSMakeRect(0.0f, 0.0f, maxWidth, 100.0f) styleMask:NSBorderlessWindowMask].size.width); 148 149 maxWidth += 5.0f; 149 windowFrame.size.width = MAX(maxWidth, windowFrame.size.width);150 maxWidth = MIN(400.0f, windowFrame.size.width);150 windowFrame.size.width = max(maxWidth, windowFrame.size.width); 151 maxWidth = min<CGFloat>(400, windowFrame.size.width); 151 152 } 152 153 [_popupWindow setFrame:windowFrame display:NO];
Note: See TracChangeset
for help on using the changeset viewer.