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

Side by Side Diff: third_party/WebKit/Source/platform/DragImage.cpp

Issue 2555923002: Changed TextDirection to an enum class and renamed its members (Closed)
Patch Set: Added 2 changes in mac files Created 4 years 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
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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 280
281 if (clipLabelString) 281 if (clipLabelString)
282 label = StringTruncator::rightTruncate( 282 label = StringTruncator::rightTruncate(
283 label, imageSize.width() - (kDragLabelBorderX * 2.0f), labelFont); 283 label, imageSize.width() - (kDragLabelBorderX * 2.0f), labelFont);
284 284
285 bool hasStrongDirectionality; 285 bool hasStrongDirectionality;
286 TextRun textRun = textRunWithDirectionality(label, &hasStrongDirectionality); 286 TextRun textRun = textRunWithDirectionality(label, &hasStrongDirectionality);
287 IntPoint textPos( 287 IntPoint textPos(
288 kDragLabelBorderX, 288 kDragLabelBorderX,
289 kDragLabelBorderY + labelFont.getFontDescription().computedPixelSize()); 289 kDragLabelBorderY + labelFont.getFontDescription().computedPixelSize());
290 if (hasStrongDirectionality && textRun.direction() == RTL) { 290 if (hasStrongDirectionality && textRun.direction() == TextDirection::Rtl) {
291 float textWidth = labelFont.width(textRun); 291 float textWidth = labelFont.width(textRun);
292 int availableWidth = imageSize.width() - kDragLabelBorderX * 2; 292 int availableWidth = imageSize.width() - kDragLabelBorderX * 2;
293 textPos.setX(availableWidth - ceilf(textWidth)); 293 textPos.setX(availableWidth - ceilf(textWidth));
294 } 294 }
295 labelFont.drawBidiText(buffer->canvas(), TextRunPaintInfo(textRun), 295 labelFont.drawBidiText(buffer->canvas(), TextRunPaintInfo(textRun),
296 FloatPoint(textPos), Font::DoNotPaintIfFontNotReady, 296 FloatPoint(textPos), Font::DoNotPaintIfFontNotReady,
297 deviceScaleFactor, textPaint); 297 deviceScaleFactor, textPaint);
298 298
299 RefPtr<Image> image = buffer->newImageSnapshot(); 299 RefPtr<Image> image = buffer->newImageSnapshot();
300 return DragImage::create(image.get(), DoNotRespectImageOrientation, 300 return DragImage::create(image.get(), DoNotRespectImageOrientation,
(...skipping 14 matching lines...) Expand all
315 m_interpolationQuality == InterpolationNone 315 m_interpolationQuality == InterpolationNone
316 ? skia::ImageOperations::RESIZE_BOX 316 ? skia::ImageOperations::RESIZE_BOX
317 : skia::ImageOperations::RESIZE_LANCZOS3; 317 : skia::ImageOperations::RESIZE_LANCZOS3;
318 int imageWidth = scaleX * m_bitmap.width(); 318 int imageWidth = scaleX * m_bitmap.width();
319 int imageHeight = scaleY * m_bitmap.height(); 319 int imageHeight = scaleY * m_bitmap.height();
320 m_bitmap = skia::ImageOperations::Resize(m_bitmap, resizeMethod, imageWidth, 320 m_bitmap = skia::ImageOperations::Resize(m_bitmap, resizeMethod, imageWidth,
321 imageHeight); 321 imageHeight);
322 } 322 }
323 323
324 } // namespace blink 324 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698