+2012-03-08 Dan Bernstein <mitz@apple.com>
+
+ <rdar://problem/10981173> Dashboard regions should not be in device space
+
+ Reviewed by John Sullivan.
+
+ Test: TestWebKitAPI/Tests/mac/DeviceScaleFactorInDashboardRegions.mm
+
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::addDashboardRegions): Stop applying the device scale factor to
+ Dashboard regions.
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::addDashboardRegions): Ditto.
+
2012-03-08 Cem Kocagil <cem.kocagil@gmail.com>
Web Inspector: Cannot insert right curly bracket on some keyboards
region.bounds.setX(absPos.x() + region.bounds.x());
region.bounds.setY(absPos.y() + region.bounds.y());
- if (frame()) {
- float deviceScaleFactor = frame()->page()->deviceScaleFactor();
- if (deviceScaleFactor != 1.0f) {
- region.bounds.scale(deviceScaleFactor);
- region.clip.scale(deviceScaleFactor);
- }
- }
-
regions.append(region);
}
}
region.bounds.setX(absPos.x() + styleRegion.offset.left().value());
region.bounds.setY(absPos.y() + styleRegion.offset.top().value());
- if (frame()) {
- float deviceScaleFactor = frame()->page()->deviceScaleFactor();
- if (deviceScaleFactor != 1.0f) {
- region.bounds.scale(deviceScaleFactor);
- region.clip.scale(deviceScaleFactor);
- }
- }
-
regions.append(region);
}
}
+2012-03-08 Dan Bernstein <mitz@apple.com>
+
+ <rdar://problem/10981173> Dashboard regions should not be in device space
+
+ Reviewed by John Sullivan.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/mac/DeviceScaleFactorInDashboardRegions.mm: Added.
+ (-[DeviceScaleFactorInDashboardRegionsUIDelegate webView:dashboardRegionsChanged:]):
+ (TestWebKitAPI):
+ (TestWebKitAPI::TEST):
+
2012-03-08 Dirk Pranke <dpranke@chromium.org>
webkit-patch works oddly on local Git branches
33E79E06137B5FD900E32D99 /* mouse-move-listener.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */; };
37200B9213A16230007A4FAD /* VectorReverse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37200B9113A16230007A4FAD /* VectorReverse.cpp */; };
3722C8691461E03E00C45D00 /* RenderedImageFromDOMRange.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */; };
+ 3776BC63150946BC0043A66D /* DeviceScaleFactorInDashboardRegions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3776BC62150946BC0043A66D /* DeviceScaleFactorInDashboardRegions.mm */; };
379028B614FABD92007E6B43 /* AcceptsFirstMouse.mm in Sources */ = {isa = PBXBuildFile; fileRef = 379028B514FABD92007E6B43 /* AcceptsFirstMouse.mm */; };
379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 379028B814FABE49007E6B43 /* acceptsFirstMouse.html */; };
3799AD3A14120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3799AD3914120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm */; };
33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "mouse-move-listener.html"; sourceTree = "<group>"; };
37200B9113A16230007A4FAD /* VectorReverse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VectorReverse.cpp; path = WTF/VectorReverse.cpp; sourceTree = "<group>"; };
3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderedImageFromDOMRange.mm; sourceTree = "<group>"; };
+ 3776BC62150946BC0043A66D /* DeviceScaleFactorInDashboardRegions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DeviceScaleFactorInDashboardRegions.mm; sourceTree = "<group>"; };
379028B514FABD92007E6B43 /* AcceptsFirstMouse.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AcceptsFirstMouse.mm; sourceTree = "<group>"; };
379028B814FABE49007E6B43 /* acceptsFirstMouse.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = acceptsFirstMouse.html; sourceTree = "<group>"; };
3799AD3914120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringByEvaluatingJavaScriptFromString.mm; sourceTree = "<group>"; };
379028B514FABD92007E6B43 /* AcceptsFirstMouse.mm */,
37DC678B140D7C5000ABCCDB /* DOMRangeOfString.mm */,
C07E6CAE13FD67650038B22B /* DynamicDeviceScaleFactor.mm */,
+ 3776BC62150946BC0043A66D /* DeviceScaleFactorInDashboardRegions.mm */,
939BA91614103412001A01BD /* DeviceScaleFactorOnBack.mm */,
C507E8A614C6545B005D6B3B /* InspectorBar.mm */,
3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */,
BC22D31514DC689800FFB1DD /* UserMessage.cpp in Sources */,
E490296814E2E3A4002BEDD1 /* TypingStyleCrash.mm in Sources */,
379028B614FABD92007E6B43 /* AcceptsFirstMouse.mm in Sources */,
+ 3776BC63150946BC0043A66D /* DeviceScaleFactorInDashboardRegions.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
--- /dev/null
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+
+#import "PlatformUtilities.h"
+#import "SyntheticBackingScaleFactorWindow.h"
+#import "Test.h"
+#import <WebKit/WebDashboardRegion.h>
+#import <wtf/RetainPtr.h>
+
+static bool gotDashboardRegions;
+static NSDictionary *regions;
+
+@interface DeviceScaleFactorInDashboardRegionsUIDelegate : NSObject {
+}
+@end
+
+@implementation DeviceScaleFactorInDashboardRegionsUIDelegate
+
+- (void)webView:(WebView *)webView dashboardRegionsChanged:(NSDictionary *)newRegions
+{
+ gotDashboardRegions = true;
+ regions = [newRegions retain];
+}
+
+@end
+
+namespace TestWebKitAPI {
+
+TEST(WebKit1, DeviceScaleFactorInDashboardRegions)
+{
+ NSRect viewFrame = NSMakeRect(0, 0, 800, 600);
+ RetainPtr<SyntheticBackingScaleFactorWindow> window(AdoptNS, [[SyntheticBackingScaleFactorWindow alloc] initWithContentRect:viewFrame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
+ [window.get() setReleasedWhenClosed:NO];
+ [window.get() setBackingScaleFactor:2];
+
+ RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:viewFrame frameName:nil groupName:nil]);
+ RetainPtr<DeviceScaleFactorInDashboardRegionsUIDelegate> uiDelegate(AdoptNS, [DeviceScaleFactorInDashboardRegionsUIDelegate new]);
+ webView.get().UIDelegate = uiDelegate.get();
+ [window.get().contentView addSubview:webView.get()];
+
+ [webView.get().mainFrame loadHTMLString:@"<div style='position: absolute; top: 10px; left: 10px; width: 50px; height: 50px; -webkit-dashboard-region: dashboard-region(control rectangle);'></div>" baseURL:[NSURL URLWithString:@"about:blank"]];
+
+ Util::run(&gotDashboardRegions);
+
+ NSRect controlRegionRect = [[[regions objectForKey:@"control"] objectAtIndex:0] dashboardRegionRect];
+
+ EXPECT_EQ(10, controlRegionRect.origin.x);
+ EXPECT_EQ(10, controlRegionRect.origin.y);
+ EXPECT_EQ(50, controlRegionRect.size.width);
+ EXPECT_EQ(50, controlRegionRect.size.height);
+
+ [regions release];
+}
+
+} // namespace TestWebKitAPI