Title: [139392] trunk/Source/WebCore
- Revision
- 139392
- Author
- [email protected]
- Date
- 2013-01-10 18:01:02 -0800 (Thu, 10 Jan 2013)
Log Message
Plugin snapshot label should take device resolution and inset into account
https://bugs.webkit.org/show_bug.cgi?id=106619
Reviewed by Simon Fraser.
* rendering/RenderSnapshottedPlugIn.cpp:
(WebCore::RenderSnapshottedPlugIn::paintLabel): Take into account the inset in the label image.
(WebCore::RenderSnapshottedPlugIn::tryToFitStartLabel): Look at the page's device scale, and adjust the label image accordingly.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (139391 => 139392)
--- trunk/Source/WebCore/ChangeLog 2013-01-11 01:54:20 UTC (rev 139391)
+++ trunk/Source/WebCore/ChangeLog 2013-01-11 02:01:02 UTC (rev 139392)
@@ -1,3 +1,14 @@
+2013-01-10 Dean Jackson <[email protected]>
+
+ Plugin snapshot label should take device resolution and inset into account
+ https://bugs.webkit.org/show_bug.cgi?id=106619
+
+ Reviewed by Simon Fraser.
+
+ * rendering/RenderSnapshottedPlugIn.cpp:
+ (WebCore::RenderSnapshottedPlugIn::paintLabel): Take into account the inset in the label image.
+ (WebCore::RenderSnapshottedPlugIn::tryToFitStartLabel): Look at the page's device scale, and adjust the label image accordingly.
+
2013-01-10 James Robinson <[email protected]>
[chromium] Store scrollable layer's contents size for coordinated scrollable layers
Modified: trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp (139391 => 139392)
--- trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp 2013-01-11 01:54:20 UTC (rev 139391)
+++ trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp 2013-01-11 02:01:02 UTC (rev 139392)
@@ -42,7 +42,8 @@
static const int autoStartPlugInSizeThresholdWidth = 1;
static const int autoStartPlugInSizeThresholdHeight = 1;
-static const int startLabelPadding = 0;
+static const int startLabelPadding = 10; // Label should be 10px from edge of box.
+static const int startLabelInset = 20; // But the label is inset from its box also. FIXME: This will be removed when we go to a ShadowDOM approach.
static const double showLabelAfterMouseOverDelay = 1;
static const double showLabelAutomaticallyDelay = 3;
@@ -178,7 +179,11 @@
if (!labelImage)
return;
- paintInfo.context->drawImage(labelImage, ColorSpaceDeviceRGB, roundedIntPoint(paintOffset + labelRect.location()), labelImage->rect());
+ // Remember that the labelRect includes the label inset, so we need to adjust for it.
+ paintInfo.context->drawImage(labelImage, ColorSpaceDeviceRGB,
+ IntRect(roundedIntPoint(paintOffset + labelRect.location() - IntSize(startLabelInset, startLabelInset)),
+ roundedIntSize(labelRect.size() + IntSize(2 * startLabelInset, 2 * startLabelInset))),
+ labelImage->rect());
}
void RenderSnapshottedPlugIn::repaintLabel()
@@ -259,7 +264,14 @@
if (!labelImage)
return LayoutRect();
- LayoutSize labelSize = labelImage->size();
+ // Assume that the labelImage has been provided to match our device scale.
+ float scaleFactor = 1;
+ if (document()->page())
+ scaleFactor = document()->page()->deviceScaleFactor();
+ IntSize labelImageSize = labelImage->size();
+ labelImageSize.scale(1 / (scaleFactor ? scaleFactor : 1));
+
+ LayoutSize labelSize = labelImageSize - LayoutSize(2 * startLabelInset, 2 * startLabelInset);
LayoutRect candidateRect(contentBox.maxXMinYCorner() + LayoutSize(-startLabelPadding, startLabelPadding) + LayoutSize(-labelSize.width(), 0), labelSize);
// The minimum allowed content box size is the label image placed in the center of the box, surrounded by startLabelPadding.
if (candidateRect.x() < startLabelPadding || candidateRect.maxY() > contentBox.height() - startLabelPadding)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes