Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: Source/core/platform/DragImage.cpp

Issue 16357011: Remove support for -webkit-color-correction (which we've never supported on (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: resolve merge conflicts, obey brace style changes Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/page/UseCounter.cpp ('k') | Source/core/platform/ScrollView.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 imageSize.setWidth(kMaxDragLabelWidth); 141 imageSize.setWidth(kMaxDragLabelWidth);
142 clipURLString = true; 142 clipURLString = true;
143 } else 143 } else
144 imageSize.setWidth(std::max(labelSize.width(), urlStringSize.width() ) + kDragLabelBorderX * 2); 144 imageSize.setWidth(std::max(labelSize.width(), urlStringSize.width() ) + kDragLabelBorderX * 2);
145 } 145 }
146 146
147 // We now know how big the image needs to be, so we create and 147 // We now know how big the image needs to be, so we create and
148 // fill the background 148 // fill the background
149 IntSize scaledImageSize = imageSize; 149 IntSize scaledImageSize = imageSize;
150 scaledImageSize.scale(deviceScaleFactor); 150 scaledImageSize.scale(deviceScaleFactor);
151 OwnPtr<ImageBuffer> buffer(ImageBuffer::create(scaledImageSize, deviceScaleF actor, ColorSpaceDeviceRGB)); 151 OwnPtr<ImageBuffer> buffer(ImageBuffer::create(scaledImageSize, deviceScaleF actor));
152 if (!buffer) 152 if (!buffer)
153 return 0; 153 return 0;
154 154
155 const float DragLabelRadius = 5; 155 const float DragLabelRadius = 5;
156 const IntSize radii(DragLabelRadius, DragLabelRadius); 156 const IntSize radii(DragLabelRadius, DragLabelRadius);
157 IntRect rect(IntPoint(), imageSize); 157 IntRect rect(IntPoint(), imageSize);
158 const Color backgroundColor(140, 140, 140); 158 const Color backgroundColor(140, 140, 140);
159 buffer->context()->fillRoundedRect(rect, radii, radii, radii, radii, backgro undColor, ColorSpaceDeviceRGB); 159 buffer->context()->fillRoundedRect(rect, radii, radii, radii, radii, backgro undColor);
160 160
161 // Draw the text 161 // Draw the text
162 if (drawURLString) { 162 if (drawURLString) {
163 if (clipURLString) 163 if (clipURLString)
164 urlString = StringTruncator::centerTruncate(urlString, imageSize.wid th() - (kDragLabelBorderX * 2.0f), urlFont, StringTruncator::EnableRoundingHacks ); 164 urlString = StringTruncator::centerTruncate(urlString, imageSize.wid th() - (kDragLabelBorderX * 2.0f), urlFont, StringTruncator::EnableRoundingHacks );
165 IntPoint textPos(kDragLabelBorderX, imageSize.height() - (kLabelBorderYO ffset + urlFont.fontMetrics().descent())); 165 IntPoint textPos(kDragLabelBorderX, imageSize.height() - (kLabelBorderYO ffset + urlFont.fontMetrics().descent()));
166 TextRun textRun(urlString); 166 TextRun textRun(urlString);
167 buffer->context()->drawText(urlFont, TextRunPaintInfo(textRun), textPos) ; 167 buffer->context()->drawText(urlFont, TextRunPaintInfo(textRun), textPos) ;
168 } 168 }
169 169
170 if (clipLabelString) 170 if (clipLabelString)
171 label = StringTruncator::rightTruncate(label, imageSize.width() - (kDrag LabelBorderX * 2.0f), labelFont, StringTruncator::EnableRoundingHacks); 171 label = StringTruncator::rightTruncate(label, imageSize.width() - (kDrag LabelBorderX * 2.0f), labelFont, StringTruncator::EnableRoundingHacks);
172 172
173 IntPoint textPos(kDragLabelBorderX, kDragLabelBorderY + labelFont.pixelSize( )); 173 IntPoint textPos(kDragLabelBorderX, kDragLabelBorderY + labelFont.pixelSize( ));
174 TextRun textRun(label); 174 TextRun textRun(label);
175 buffer->context()->drawText(urlFont, TextRunPaintInfo(textRun), textPos); 175 buffer->context()->drawText(urlFont, TextRunPaintInfo(textRun), textPos);
176 176
177 RefPtr<Image> image = buffer->copyImage(); 177 RefPtr<Image> image = buffer->copyImage();
178 return createDragImageFromImage(image.get()); 178 return createDragImageFromImage(image.get());
179 } 179 }
180 180
181 } // namespace WebCore 181 } // namespace WebCore
182 182
OLDNEW
« no previous file with comments | « Source/core/page/UseCounter.cpp ('k') | Source/core/platform/ScrollView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698