Commit 0e79135f authored by leviw@chromium.org's avatar leviw@chromium.org
Browse files

2012-04-17 Levi Weintraub <leviw@chromium.org>

Clean up outstanding LayoutUnit misuse in WebCore
https://bugs.webkit.org/show_bug.cgi?id=84209

Reviewed by Eric Seidel.

Small changes to a handful of files to prepare trunk for FractionalLayoutUnits.
For more details, see https://trac.webkit.org/wiki/LayoutUnit

No new tests. No change in behavior.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): minimumValueForLength preserves
sub-pixel precision, so we should avoid unnecessarily using integers.
* platform/graphics/FractionalLayoutPoint.h:
(WebCore::FractionalLayoutPoint::FractionalLayoutPoint): Adding an explicit constructor from
FractionalLayoutSizes. This mirrors a method in IntPoint.
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintBorder): The rects that change come from roundedRects,
which are already pixel-snapped.
* rendering/RenderBoxModelObject.h: Removing a comment that is no longer applicable.
* rendering/RenderTable.cpp:
(WebCore::RenderTable::computeLogicalWidth): Since we layout tables using integers, we
need to explicitly calculate the width to be integral as well to avoid pushing the next element
over by a pixel that we won't later paint with our own box decorations.
* rendering/RenderText.h:
(RenderText): Correcting an unfortunate mismatch between in the return value of linesBoundingBox
between the header and implementation.
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::getRoundedBorderFor): We were incorrectly not using the snapped border
rect to pass to calcRadiiFor (which takes an IntRect). Correcting this.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114470 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9348191f
2012-04-17 Levi Weintraub <leviw@chromium.org>
Clean up outstanding LayoutUnit misuse in WebCore
https://bugs.webkit.org/show_bug.cgi?id=84209
Reviewed by Eric Seidel.
Small changes to a handful of files to prepare trunk for FractionalLayoutUnits.
For more details, see https://trac.webkit.org/wiki/LayoutUnit
No new tests. No change in behavior.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): minimumValueForLength preserves
sub-pixel precision, so we should avoid unnecessarily using integers.
* platform/graphics/FractionalLayoutPoint.h:
(WebCore::FractionalLayoutPoint::FractionalLayoutPoint): Adding an explicit constructor from
FractionalLayoutSizes. This mirrors a method in IntPoint.
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintBorder): The rects that change come from roundedRects,
which are already pixel-snapped.
* rendering/RenderBoxModelObject.h: Removing a comment that is no longer applicable.
* rendering/RenderTable.cpp:
(WebCore::RenderTable::computeLogicalWidth): Since we layout tables using integers, we
need to explicitly calculate the width to be integral as well to avoid pushing the next element
over by a pixel that we won't later paint with our own box decorations.
* rendering/RenderText.h:
(RenderText): Correcting an unfortunate mismatch between in the return value of linesBoundingBox
between the header and implementation.
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::getRoundedBorderFor): We were incorrectly not using the snapped border
rect to pass to calcRadiiFor (which takes an IntRect). Correcting this.
2012-04-17 Luke Macpherson <macpherson@chromium.org>
 
Ensure CSSParser member variables are initialized.
......@@ -2240,7 +2240,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
case CSSPropertyWebkitTransformOrigin: {
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
if (renderer) {
IntRect box = sizingBox(renderer);
LayoutRect box = sizingBox(renderer);
RenderView* renderView = m_node->document()->renderView();
list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginX(), box.width(), renderView), style.get()));
list->append(zoomAdjustedPixelValue(minimumValueForLength(style->transformOriginY(), box.height(), renderView), style.get()));
......
......@@ -43,6 +43,7 @@ public:
FractionalLayoutPoint(FractionalLayoutUnit x, FractionalLayoutUnit y) : m_x(x), m_y(y) { }
FractionalLayoutPoint(const IntPoint& point) : m_x(point.x()), m_y(point.y()) { }
explicit FractionalLayoutPoint(const FloatPoint& size) : m_x(size.x()), m_y(size.y()) { }
explicit FractionalLayoutPoint(const FractionalLayoutSize& size) : m_x(size.width()), m_y(size.height()) { }
static FractionalLayoutPoint zero() { return FractionalLayoutPoint(); }
......
......@@ -1910,8 +1910,8 @@ void RenderBoxModelObject::paintBorder(const PaintInfo& info, const LayoutRect&
path.addRect(outerBorder.rect());
if (haveAllDoubleEdges) {
LayoutRect innerThirdRect = outerBorder.rect();
LayoutRect outerThirdRect = outerBorder.rect();
IntRect innerThirdRect = outerBorder.rect();
IntRect outerThirdRect = outerBorder.rect();
for (int side = BSTop; side <= BSLeft; ++side) {
int outerWidth;
int innerWidth;
......
......@@ -72,7 +72,6 @@ public:
int pixelSnappedOffsetLeft() const { return roundToInt(offsetLeft()); }
int pixelSnappedOffsetTop() const { return roundToInt(offsetTop()); }
// FIXME: The implementation for these functions will change once we move to subpixel layout. See bug 60318.
int pixelSnappedOffsetWidth() const;
int pixelSnappedOffsetHeight() const;
......
......@@ -240,16 +240,16 @@ void RenderTable::computeLogicalWidth()
}
// Ensure we aren't bigger than our available width.
setLogicalWidth(min(availableContentLogicalWidth, maxPreferredLogicalWidth()));
setLogicalWidth(min<int>(availableContentLogicalWidth, maxPreferredLogicalWidth()));
}
// Ensure we aren't smaller than our min preferred width.
setLogicalWidth(max(logicalWidth(), minPreferredLogicalWidth()));
setLogicalWidth(max<int>(logicalWidth(), minPreferredLogicalWidth()));
// Ensure we aren't smaller than our min-width style.
Length styleMinLogicalWidth = style()->logicalMinWidth();
if (styleMinLogicalWidth.isSpecified() && styleMinLogicalWidth.isPositive())
setLogicalWidth(max(logicalWidth(), convertStyleLogicalWidthToComputedWidth(styleMinLogicalWidth, availableLogicalWidth)));
setLogicalWidth(max<int>(logicalWidth(), convertStyleLogicalWidthToComputedWidth(styleMinLogicalWidth, availableLogicalWidth)));
// Finally, with our true width determined, compute our margins for real.
setMarginStart(0);
......
......@@ -83,7 +83,7 @@ public:
float& beginMaxW, float& endMaxW,
float& minW, float& maxW, bool& stripFrontSpaces);
virtual LayoutRect linesBoundingBox() const;
virtual IntRect linesBoundingBox() const;
LayoutRect linesVisualOverflowBoundingBox() const;
FloatPoint firstRunOrigin() const;
......
......@@ -930,7 +930,7 @@ RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, Rende
IntRect snappedBorderRect(pixelSnappedIntRect(borderRect));
RoundedRect roundedRect(snappedBorderRect);
if (hasBorderRadius()) {
RoundedRect::Radii radii = calcRadiiFor(surround->border, borderRect.size(), renderView);
RoundedRect::Radii radii = calcRadiiFor(surround->border, snappedBorderRect.size(), renderView);
radii.scale(calcConstraintScaleFor(snappedBorderRect, radii));
roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includeLogicalLeftEdge, includeLogicalRightEdge);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment