| OLD | NEW |
| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 buffer->context()->drawText(urlFont, TextRunPaintInfo(textRun), textPos)
; | 182 buffer->context()->drawText(urlFont, TextRunPaintInfo(textRun), textPos)
; |
| 183 } | 183 } |
| 184 | 184 |
| 185 if (clipLabelString) | 185 if (clipLabelString) |
| 186 label = StringTruncator::rightTruncate(label, imageSize.width() - (kDrag
LabelBorderX * 2.0f), labelFont); | 186 label = StringTruncator::rightTruncate(label, imageSize.width() - (kDrag
LabelBorderX * 2.0f), labelFont); |
| 187 | 187 |
| 188 bool hasStrongDirectionality; | 188 bool hasStrongDirectionality; |
| 189 TextRun textRun = textRunWithDirectionality(label, hasStrongDirectionality); | 189 TextRun textRun = textRunWithDirectionality(label, hasStrongDirectionality); |
| 190 IntPoint textPos(kDragLabelBorderX, kDragLabelBorderY + labelFont.fontDescri
ption().computedPixelSize()); | 190 IntPoint textPos(kDragLabelBorderX, kDragLabelBorderY + labelFont.fontDescri
ption().computedPixelSize()); |
| 191 if (hasStrongDirectionality && textRun.direction() == RTL) { | 191 if (hasStrongDirectionality && textRun.direction() == RTL) { |
| 192 float textWidth = urlFont.width(textRun); | 192 float textWidth = labelFont.width(textRun); |
| 193 int availableWidth = imageSize.width() - kDragLabelBorderX * 2; | 193 int availableWidth = imageSize.width() - kDragLabelBorderX * 2; |
| 194 textPos.setX(availableWidth - ceilf(textWidth)); | 194 textPos.setX(availableWidth - ceilf(textWidth)); |
| 195 } | 195 } |
| 196 buffer->context()->drawBidiText(urlFont, TextRunPaintInfo(textRun), textPos)
; | 196 buffer->context()->drawBidiText(labelFont, TextRunPaintInfo(textRun), textPo
s); |
| 197 | 197 |
| 198 RefPtr<Image> image = buffer->copyImage(); | 198 RefPtr<Image> image = buffer->copyImage(); |
| 199 return DragImage::create(image.get(), DoNotRespectImageOrientation, deviceSc
aleFactor); | 199 return DragImage::create(image.get(), DoNotRespectImageOrientation, deviceSc
aleFactor); |
| 200 } | 200 } |
| 201 | 201 |
| 202 DragImage::DragImage(const SkBitmap& bitmap, float resolutionScale) | 202 DragImage::DragImage(const SkBitmap& bitmap, float resolutionScale) |
| 203 : m_bitmap(bitmap) | 203 : m_bitmap(bitmap) |
| 204 , m_resolutionScale(resolutionScale) | 204 , m_resolutionScale(resolutionScale) |
| 205 { | 205 { |
| 206 } | 206 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 *pixel = SkPreMultiplyARGB( | 263 *pixel = SkPreMultiplyARGB( |
| 264 SkColorGetA(*pixel) * fraction, | 264 SkColorGetA(*pixel) * fraction, |
| 265 SkColorGetR(*pixel), | 265 SkColorGetR(*pixel), |
| 266 SkColorGetG(*pixel), | 266 SkColorGetG(*pixel), |
| 267 SkColorGetB(*pixel)); | 267 SkColorGetB(*pixel)); |
| 268 } | 268 } |
| 269 } | 269 } |
| 270 } | 270 } |
| 271 | 271 |
| 272 } // namespace blink | 272 } // namespace blink |
| OLD | NEW |