Title: [107841] branches/subpixellayout/Source
Revision
107841
Author
[email protected]
Date
2012-02-15 14:33:51 -0800 (Wed, 15 Feb 2012)

Log Message

Add LayoutUnit version of StylePropertySet::setProperty and change DeleteButtonController to use it.

Modified Paths

Diff

Modified: branches/subpixellayout/Source/WebCore/css/StylePropertySet.cpp (107840 => 107841)


--- branches/subpixellayout/Source/WebCore/css/StylePropertySet.cpp	2012-02-15 22:14:51 UTC (rev 107840)
+++ branches/subpixellayout/Source/WebCore/css/StylePropertySet.cpp	2012-02-15 22:33:51 UTC (rev 107841)
@@ -839,6 +839,16 @@
     return true;
 }
 
+
+bool StylePropertySet::setProperty(int propertyID, LayoutUnit value, CSSPrimitiveValue::UnitTypes unit, bool important, bool notifyChanged)
+{
+    CSSProperty property(propertyID, CSSPrimitiveValue::create(value, unit), important);
+    setProperty(property);
+    if (notifyChanged)
+        setNeedsStyleRecalc();
+    return true;
+}
+
 void StylePropertySet::parseDeclaration(const String& styleDeclaration)
 {
 #if ENABLE(MUTATION_OBSERVERS)

Modified: branches/subpixellayout/Source/WebCore/css/StylePropertySet.h (107840 => 107841)


--- branches/subpixellayout/Source/WebCore/css/StylePropertySet.h	2012-02-15 22:14:51 UTC (rev 107840)
+++ branches/subpixellayout/Source/WebCore/css/StylePropertySet.h	2012-02-15 22:33:51 UTC (rev 107841)
@@ -25,6 +25,7 @@
 #include "CSSProperty.h"
 #include "CSSStyleDeclaration.h"
 #include "KURLHash.h"
+#include "LayoutTypes.h"
 #include "PlatformString.h"
 #include <wtf/ListHashSet.h>
 #include <wtf/Vector.h>
@@ -74,6 +75,7 @@
     bool isPropertyImplicit(int propertyID) const;
 
     bool setProperty(int propertyID, int value, bool important = false) { return setProperty(propertyID, value, important, true); }
+    bool setProperty(int propertyID, LayoutUnit value, CSSPrimitiveValue::UnitTypes unit, bool important = false) { return setProperty(propertyID, value, unit, important, true); }
     bool setProperty(int propertyId, double value, CSSPrimitiveValue::UnitTypes unit, bool important = false) { return setProperty(propertyId, value, unit, important, true); }
     bool setProperty(int propertyID, const String& value, bool important = false) { return setProperty(propertyID, value, important, true); }
     void setProperty(const CSSProperty&, CSSProperty* slot = 0);
@@ -145,6 +147,7 @@
     template<size_t size> String getLayeredShorthandValue(const int (&properties)[size]) const { return getLayeredShorthandValue(properties, size); }
 
     bool setProperty(int propertyID, int value, bool important, bool notifyChanged);
+    bool setProperty(int propertyId, LayoutUnit value, CSSPrimitiveValue::UnitTypes, bool important, bool notifyChanged);
     bool setProperty(int propertyId, double value, CSSPrimitiveValue::UnitTypes, bool important, bool notifyChanged);
     bool setProperty(int propertyID, const String& value, bool important, bool notifyChanged);
     bool removeShorthandProperty(int propertyID, bool notifyChanged);

Modified: branches/subpixellayout/Source/WebCore/editing/DeleteButtonController.cpp (107840 => 107841)


--- branches/subpixellayout/Source/WebCore/editing/DeleteButtonController.cpp	2012-02-15 22:14:51 UTC (rev 107840)
+++ branches/subpixellayout/Source/WebCore/editing/DeleteButtonController.cpp	2012-02-15 22:33:51 UTC (rev 107841)
@@ -226,10 +226,10 @@
     style = outline->ensureInlineStyleDecl();
     style->setProperty(CSSPropertyPosition, CSSValueAbsolute);
     style->setProperty(CSSPropertyZIndex, String::number(-1000000));
-    style->setProperty(CSSPropertyTop, String::number((-borderWidth - m_target->renderBox()->borderTop()).toFloat()) + "px");
-    style->setProperty(CSSPropertyRight, String::number((-borderWidth - m_target->renderBox()->borderRight()).toFloat()) + "px");
-    style->setProperty(CSSPropertyBottom, String::number((-borderWidth - m_target->renderBox()->borderBottom()).toFloat()) + "px");
-    style->setProperty(CSSPropertyLeft, String::number((-borderWidth - m_target->renderBox()->borderLeft()).toFloat()) + "px");
+    style->setProperty(CSSPropertyTop, -borderWidth - m_target->renderBox()->borderTop(), CSSPrimitiveValue::CSS_PX);
+    style->setProperty(CSSPropertyRight, -borderWidth - m_target->renderBox()->borderRight(), CSSPrimitiveValue::CSS_PX);
+    style->setProperty(CSSPropertyBottom, -borderWidth - m_target->renderBox()->borderBottom(), CSSPrimitiveValue::CSS_PX);
+    style->setProperty(CSSPropertyLeft, -borderWidth - m_target->renderBox()->borderLeft(), CSSPrimitiveValue::CSS_PX);
     style->setProperty(CSSPropertyBorder, String::number(borderWidth) + "px solid rgba(0, 0, 0, 0.6)");
     style->setProperty(CSSPropertyWebkitBorderRadius, String::number(borderRadius) + "px");
     style->setProperty(CSSPropertyVisibility, CSSValueVisible);

Modified: branches/subpixellayout/Source/WebKit/mac/WebView/WebFrame.mm (107840 => 107841)


--- branches/subpixellayout/Source/WebKit/mac/WebView/WebFrame.mm	2012-02-15 22:14:51 UTC (rev 107840)
+++ branches/subpixellayout/Source/WebKit/mac/WebView/WebFrame.mm	2012-02-15 22:33:51 UTC (rev 107841)
@@ -1296,8 +1296,8 @@
         return [NSArray array];
 
     const LayoutRect& documentRect = root->documentRect();
-    float printWidth = root->style()->isHorizontalWritingMode() ? documentRect.width().toFloat() / printScaleFactor : pageSize.width;
-    float printHeight = root->style()->isHorizontalWritingMode() ? pageSize.height : documentRect.height().toFloat() / printScaleFactor;
+    float printWidth = root->style()->isHorizontalWritingMode() ? static_cast<float>(documentRect.width()) / printScaleFactor : pageSize.width;
+    float printHeight = root->style()->isHorizontalWritingMode() ? pageSize.height : static_cast<float>(documentRect.height()) / printScaleFactor;
 
     PrintContext printContext(_private->coreFrame);
     printContext.computePageRectsWithPageSize(FloatSize(printWidth, printHeight), true);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to