https://bugs.webkit.org/show_bug.cgi?id=77168
Reviewed by Sam Weinig.
Source/WebCore:
* css/CSSPrimitiveValueMappings.h: Assert that CompositeDifference is
not converted to a CSS value. Exposing a new compositing operation to
CSS is outside the scope of this patch.
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
* platform/graphics/GraphicsTypes.h: Add CompositeDifference as a
CompositeOperator. Also, remove an outdated comment.
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::setPlatformCompositeOperation): Map
CompositeDifference to kCGBlendModeDifference.
Source/WebKit/win:
* WebView.cpp:
(WebView::WebView): Initialize m_shouldInvertColors to false.
(WebView::paintIntoBackingStore): If m_shouldInvertColors is true, draw
an opaque white quad using the CompositeDifference blend mode. This
blend operation instructs CoreGraphics to take the difference between
the source pixel (white) and the background pixel, resulting in an
inverted pixel.
* WebView.h: Define m_shouldInvertColors.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106274
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-01-26 Andy Estes <aestes@apple.com>
+
+ [Windows] Optionally invert colors when drawing to a WebView's backing store.
+ https://bugs.webkit.org/show_bug.cgi?id=77168
+
+ Reviewed by Sam Weinig.
+
+ * css/CSSPrimitiveValueMappings.h: Assert that CompositeDifference is
+ not converted to a CSS value. Exposing a new compositing operation to
+ CSS is outside the scope of this patch.
+ (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+ * platform/graphics/GraphicsTypes.h: Add CompositeDifference as a
+ CompositeOperator. Also, remove an outdated comment.
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::GraphicsContext::setPlatformCompositeOperation): Map
+ CompositeDifference to kCGBlendModeDifference.
+
2012-01-28 Matthew Delaney <mdelaney@apple.com>
Limit the shadow offset CG hack to just SL and Lion
case CompositePlusLighter:
m_value.ident = CSSValuePlusLighter;
break;
+ case CompositeDifference:
+ ASSERT_NOT_REACHED();
+ break;
}
}
namespace WebCore {
- // Note: These constants exactly match the NSCompositeOperator constants of
- // AppKit on Mac OS X Tiger. If these ever change, we'll need to change the
- // Mac OS X Tiger platform code to map one to the other.
enum CompositeOperator {
CompositeClear,
CompositeCopy,
CompositeDestinationAtop,
CompositeXOR,
CompositePlusDarker,
- CompositePlusLighter
+ CompositePlusLighter,
+ CompositeDifference
};
enum GradientSpreadMethod {
case CompositePlusLighter:
target = kCGBlendModePlusLighter;
break;
+ case CompositeDifference:
+ target = kCGBlendModeDifference;
+ break;
}
CGContextSetBlendMode(platformContext(), target);
}
+2012-01-26 Andy Estes <aestes@apple.com>
+
+ [Windows] Optionally invert colors when drawing to a WebView's backing store.
+ https://bugs.webkit.org/show_bug.cgi?id=77168
+
+ Reviewed by Sam Weinig.
+
+ * WebView.cpp:
+ (WebView::WebView): Initialize m_shouldInvertColors to false.
+ (WebView::paintIntoBackingStore): If m_shouldInvertColors is true, draw
+ an opaque white quad using the CompositeDifference blend mode. This
+ blend operation instructs CoreGraphics to take the difference between
+ the source pixel (white) and the background pixel, resulting in an
+ inverted pixel.
+ * WebView.h: Define m_shouldInvertColors.
+
2012-01-23 Simon Fraser <simon.fraser@apple.com>
Show layer borders for scrollbar layers
WebView::WebView()
: m_refCount(0)
+ , m_shouldInvertColors(false)
#if !ASSERT_DISABLED
, m_deletionHasBegun(false)
#endif
if (frameView && frameView->frame() && frameView->frame()->contentRenderer()) {
gc.clip(dirtyRect);
frameView->paint(&gc, dirtyRect);
+ if (m_shouldInvertColors)
+ gc.fillRect(dirtyRect, Color::white, ColorSpaceDeviceRGB, CompositeDifference);
}
gc.restore();
}
virtual void flushPendingGraphicsLayerChanges();
#endif
+ bool m_shouldInvertColors;
+
protected:
static bool registerWebViewWindowClass();
static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);