Source/WebCore: [Windows] Change from using OwnPtr<GDI Stuff> to new GDIObject template.
https://bugs.webkit.org/show_bug.cgi?id=120778

Reviewed by Anders Carlsson.

Change code to use a GDI-specific smart pointer, rather than OwnPtr. This
is a first step to simplifying OwnPtr. It also gets rid of some Windows-
specific code in WTF.

* WebCore.vcxproj/WebCore.vcxproj: Add the new header file.
* WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
* page/win/FrameCGWin.cpp:
(WebCore::imageFromRect): Switch to GDIObject.
* page/win/FrameCairoWin.cpp:
(WebCore::imageFromRect): Switch to GDIObject.
* page/win/FrameWin.cpp:
(WebCore::imageFromSelection): Switch to GDIObject.
(WebCore::Frame::dragImageForSelection): Ditto.
(WebCore::Frame::nodeImage): Ditto.
* page/win/FrameWin.h:
* platform/graphics/ca/win/CACFLayerTreeHost.cpp:
(WebCore::getDirtyRects): Switch from OwnPtr to GDIObject.
* platform/graphics/win/FontCacheWin.cpp:
(WebCore::createGDIFont): Switch to GDIObject.
(WebCore::FontCache::createFontPlatformData): Ditto.
* platform/graphics/win/FontCustomPlatformData.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData): Switch to GDIObject.
* platform/graphics/win/FontCustomPlatformDataCairo.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData): Switch to GDIObject.
* platform/graphics/win/GraphicsContextCGWin.cpp:
(WebCore::GraphicsContext::releaseWindowsContext): Switch to GDIObject.
* platform/graphics/win/GraphicsContextCairoWin.cpp:
(WebCore::GraphicsContext::releaseWindowsContext): Switch to GDIObject.
* platform/graphics/win/GraphicsContextWin.cpp:
(WebCore::GraphicsContext::getWindowsContext): Switch to GDIObject.
* platform/graphics/win/SimpleFontDataWin.cpp:
(WebCore::SimpleFontData::platformCreateScaledFontData): Switch to GDIObject.
* platform/win/CursorWin.cpp:
(WebCore::createSharedCursor): Switch to GDIObject.
* platform/win/DragImageCGWin.cpp:
(WebCore::scaleDragImage): Switch to GDIObject.
(WebCore::createDragImageFromImage):
* platform/win/DragImageCairoWin.cpp: 
(WebCore::scaleDragImage): Switch to GDIObject.
(WebCore::createDragImageFromImage): Ditto.
* platform/win/DragImageWin.cpp:
(WebCore::createDragImageForLink): Switch to GDIObject.
* platform/win/PasteboardWin.cpp:
(WebCore::Pasteboard::writeImage): Switch to GDIObject.
* platform/win/ScrollbarThemeWin.cpp:
(WebCore::ScrollbarThemeWin::paintTrackPiece): Switch to GDIObject.
* plugins/win/PluginViewWin.cpp:
(WebCore::PluginView::updatePluginWidget): Switch to GDIObject.
(WebCore::PluginView::snapshot): Ditto.
* rendering/RenderThemeWin.cpp:
(WebCore::drawControl): Switch to GDIObject.

Source/WebKit/win: [Windows] Change from using OwnPtr<GDI Stuff> to new GDIObject template.
https://bugs.webkit.org/show_bug.cgi?id=120778

Reviewed by Anders Carlsson.

* FullscreenVideoController.cpp:
(FullscreenVideoController::createHUDWindow): Switch to GDIObject.
(FullscreenVideoController::draw): Ditto.
* FullscreenVideoController.h:
* WebCoreSupport/EmbeddedWidget.cpp:
(EmbeddedWidget::frameRectsChanged): Switch to GDIObject.
* WebNodeHighlight.cpp:
(WebNodeHighlight::update): Switch to GDIObject.
* WebView.cpp:
(WebView::scrollBackingStore): Switch to GDIObject.
(WebView::updateBackingStore): Ditto.
(WebView::performLayeredWindowUpdate): Ditto.
(WebView::paint): Ditto.
(WebView::paintIntoBackingStore): Ditto.
(WebView::paintIntoWindow): Ditto.
(WebView::generateSelectionImage): Ditto.

Source/WTF: [Windows] Change from using OwnPtr<GDI Stuff> to new GDIObject template.
https://bugs.webkit.org/show_bug.cgi?id=120778

Reviewed by Anders Carlsson.

* WTF.vcxproj/WTF.vcxproj: Add new GDIObject header file.
* WTF.vcxproj/WTF.vcxproj.filters: Ditto.
* WTF.vcxproj/copy-files.cmd: Copy new header file.
* wtf/OwnPtrCommon.h: Remove some GDI specializations.
* wtf/win/GDIObject.h: Added.
(WTF::GDIObject::GDIObject):
(WTF::GDIObject::~GDIObject):
(WTF::GDIObject::get):
(WTF::GDIObject::operator!):
(WTF::GDIObject::operator UnspecifiedBoolType):
(WTF::GDIObject::operator=):
(WTF::GDIObject::swap):
(WTF::::clear):
(WTF::::leak):
(WTF::::GDIObject):
(WTF::=):
(WTF::adoptGDIObject):
(WTF::swap):
(WTF::T):
(WTF::HDC):
* wtf/win/OwnPtrWin.cpp:
(WTF::deleteOwnedPtr): Remove some GDI specializations.

Tools: [Windows] Change from using OwnPtr<GDI Stuff> to new GDIObject.
https://bugs.webkit.org/show_bug.cgi?id=120778

Reviewed by Anders Carlsson.

* DumpRenderTree/win/PixelDumpSupportWin.cpp:
(createBitmapContextFromWebView): Use GDIObject.
* Scripts/webkitpy/style/checkers/cpp.py:
(check_for_leaky_patterns): Update for GDIObject instead of adoptPtr and OwnPtr.
* Scripts/webkitpy/style/checkers/cpp_unittest.py:
(LeakyPatternTest.test_create_dc): Update for GDIObject instead of adoptPtr/OwnPtr.
(LeakyPatternTest.test_create_compatible_dc): Ditto.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155454 268f45cc-cd09-0410-ab3c-d52691b4dbfc
jsc commandline's run() function should take extra arguments
https://bugs.webkit.org/show_bug.cgi?id=121098

Reviewed by Michael Saboff.

* jsc.cpp:
(functionRun):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155455 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] accessibility/loading-iframe-sends-notification.html is failing
https://bugs.webkit.org/show_bug.cgi?id=98370

Patch by Denis Nomiyama <d.nomiyama@samsung.com> on 2013-09-10
Reviewed by Chris Fleizach.

Source/WebCore:

Enabled AXLayoutComplete on the GTK platform.

No new tests are required because this feature will use an existing
accessibility layout test that is currently failing on the GTK+ platform
(e.g. loading-iframe-sends-notification.html).

* accessibility/atk/AXObjectCacheAtk.cpp:
(WebCore::AXObjectCache::postPlatformNotification): Send layout-complete
signal in case of AXLayoutComplete.
* dom/Document.cpp:
(WebCore::Document::implicitClose): Enabled AXLayoutComplete on the GTK
platform.
* page/FrameView.cpp:
(WebCore::FrameView::layout): Enabled AXLayoutComplete on the GTK
platform.

Tools:

Added AXLayoutComplete for the GTK platform.

* DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp:
(axObjectEventListener): Added notification AXLayoutComplete for
layout-complete signal.

LayoutTests:

Changed the expectation of the loading iframe notification test in
accessibility, which was failing before this fix on the GTK+
platform.

* platform/gtk/TestExpectations: Changed the expectation of the loading
iframe notification test in accessibility.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155456 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Don't GC while in the OSR-triggered jettison code
https://bugs.webkit.org/show_bug.cgi?id=121106

Reviewed by Mark Hahnenberg.

* dfg/DFGOperations.cpp:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
AX: Expose DOM ID and ClassList to AX APIs for automation and AT element hashes
https://bugs.webkit.org/show_bug.cgi?id=120552

Reviewed by Darin Adler.

Source/WebCore: 

Add Mac support for exposing the DOM ID and DOM class list so that accessibility
clients can leverage that information.

Test: platform/mac/accessibility/id-class-attributes.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::domIdentifier):
(WebCore::AccessibilityObject::domClassList):
* accessibility/AccessibilityObject.h:
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
(convertStringsToNSArray):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):

Tools: 

* DumpRenderTree/AccessibilityUIElement.cpp:
(getClassListCallback):
(AccessibilityUIElement::getJSClass):
* DumpRenderTree/AccessibilityUIElement.h:
* DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:
(AccessibilityUIElement::classList):
* DumpRenderTree/blackberry/AccessibilityUIElementBlackBerry.cpp:
(AccessibilityUIElement::classList):
* DumpRenderTree/mac/AccessibilityUIElementMac.mm:
(AccessibilityUIElement::classList):
* DumpRenderTree/win/AccessibilityUIElementWin.cpp:
(AccessibilityUIElement::classList):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
(WTR::AccessibilityUIElement::classList):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::AccessibilityUIElement::classList):
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::classList):

LayoutTests: 

Tests that output all attributes need to be updated, since the DOM ID and DOM
class list are new on all elements.

* accessibility/transformed-element-expected.txt:
* platform/mac/accessibility/aria-columnrowheaders-expected.txt:
* platform/mac/accessibility/bounds-for-range-expected.txt:
* platform/mac/accessibility/document-attributes-expected.txt:
* platform/mac/accessibility/document-links-expected.txt:
* platform/mac/accessibility/id-class-attributes-expected.txt: Added.
* platform/mac/accessibility/id-class-attributes.html: Added.
* platform/mac/accessibility/image-link-expected.txt:
* platform/mac/accessibility/image-map2-expected.txt:
* platform/mac/accessibility/internal-link-anchors-expected.txt:
* platform/mac/accessibility/internal-link-anchors2-expected.txt:
* platform/mac/accessibility/lists-expected.txt:
* platform/mac/accessibility/plugin-expected.txt:
* platform/mac/accessibility/radio-button-group-members-expected.txt:
* platform/mac/accessibility/table-attributes-expected.txt:
* platform/mac/accessibility/table-cell-spans-expected.txt:
* platform/mac/accessibility/table-cells-expected.txt:
* platform/mac/accessibility/table-detection-expected.txt:
* platform/mac/accessibility/table-one-cell-expected.txt:
* platform/mac/accessibility/table-sections-expected.txt:
* platform/mac/accessibility/table-with-aria-role-expected.txt:
* platform/mac/accessibility/table-with-rules-expected.txt:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155458 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2][GTK] Frequent crashes when showing context menus in Debug builds
https://bugs.webkit.org/show_bug.cgi?id=121099

Reviewed by Carlos Garcia Campos.

Disconnect signal handlers when destroying the context menu proxy
object. This avoids use-after-free crashes when opening several
context menus in a row.

* UIProcess/gtk/WebContextMenuProxyGtk.cpp:
(WebKit::WebContextMenuProxyGtk::append):
(WebKit::WebContextMenuProxyGtk::~WebContextMenuProxyGtk):
* UIProcess/gtk/WebContextMenuProxyGtk.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155459 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[mac] <progress> has rendering artifacts along the bottom
https://bugs.webkit.org/show_bug.cgi?id=120865
<rdar://problem/11571240>

Reviewed by Simon Fraser.

Allow RenderTheme to force the height of a <progress> bar.

Test: platform/mac/fast/forms/indeterminate-progress-inline-height.html

* rendering/RenderProgress.cpp:
(WebCore::RenderProgress::computeLogicalHeight):
Borrowed from RenderMeter, allow the theme to override the size of the progress bar.

* rendering/RenderProgress.h:
Drive-by add OVERRIDE to a few things.

* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::progressBarRectForBounds):
* rendering/RenderTheme.h:
Add a default implementation of progressBarRectForBounds that just passes the bounds through.

* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::progressBarRectForBounds):
Override progressBarRectForBounds; the implementation is factored out of paintProgressBar.

(WebCore::RenderThemeMac::paintProgressBar):
Make use of the factored-out progressBarRectForBounds().

Drive-by apply the device scale factor to the progress bar's image buffer,
so that it is rendered at 2x on appropriate hardware. Also, multiply the
progress animation phase by the device scale factor, as the phase value seems
to be proportional to the actual pixel offset of the animation; without this,
the animation would appear to progress half as slowly in HiDPI.

Add a Mac-specific test that an unstyled indeterminate progress bar
overrides its specified height with its fixed system height.

* platform/mac/fast/forms/indeterminate-progress-inline-height-expected.txt: Added.
* platform/mac/fast/forms/indeterminate-progress-inline-height.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155460 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[mac] PDFDocumentImage should use PDFKit to draw
https://bugs.webkit.org/show_bug.cgi?id=120651
<rdar://problem/12810731>

Reviewed by Alexey Proskuryakov.

Use PDFKit to draw PDF-in-<img> on Mac, so that annotations in PDF are painted.

Test: fast/images/pdf-as-image-with-annotations.html

* WebCore.xcodeproj/project.pbxproj:
Add PDFDocumentImageMac.mm.

* platform/graphics/cg/PDFDocumentImage.cpp:
(WebCore::PDFDocumentImage::PDFDocumentImage):
We don't need to initialize m_document anymore because it's now a RetainPtr.
Initialize m_hasPage to false.

(WebCore::PDFDocumentImage::~PDFDocumentImage):
We don't need to manually release our CGPDFDocumentRef anymore because it's now a RetainPtr.

(WebCore::PDFDocumentImage::size):
Use expandedIntSize for explicitness.

(WebCore::PDFDocumentImage::applyRotationForPainting):
Rename adjustCTM to applyRotationForPainting, and move the one non-rotation related transformation out.
We need to do this because PDFKit applies the rotation transformation itself, so we don't need to.
Also, explicitly use std::min instead of importing the whole std namespace.

(WebCore::PDFDocumentImage::dataChanged):
Assert that we don't re-enter dataChanged after we've created a document,
because it seems like that shouldn't happen - we only create a document when
we've supposedly received all data, and it would be nice if we didn't have
all this varying code to deal with SharedBuffers changing out from under each other.
Factor the code to create a CGPDFDocumentRef out into createPDFDocument, so we can
replace it with a different implementation that creates a PDFDocument.

(WebCore::PDFDocumentImage::setCurrentPage):
Make all page-number-related things unsigned, since they are in CG and PDFKit,
and add m_hasPage to denote whether we've acquired a valid page yet.
Factor code to retrieve the PDF box bounds into computeBoundsForCurrentPage.
Remove setCurrentPage itself, as we never use a page other than the first page;
we will call computeBoundsForCurrentPage and set hasPage in dataChanged, now.

(WebCore::PDFDocumentImage::draw):
Fix a weird comment.
Factor code that actually draws the PDF out into drawPDFPage.

The rest of the functions in this file are only built for USE(CG) && !PLATFORM(MAC):

(WebCore::PDFDocumentImage::createPDFDocument):
Factored out of dataChanged(). Use the PLATFORM(MAC) way of making a
CGDataProvider from a SharedBuffer everywhere; we're already using it on
iOS, and it should also work for Windows, the only other USE(CG) platform.
Since we only createPDFDocument() after all data has been received, remove
the comment about the SharedBuffer being secretly written to behind its back.

(WebCore::PDFDocumentImage::computeBoundsForCurrentPage):
Factored out of setCurrentPage().
Use deg2rad since we have it.

(WebCore::PDFDocumentImage::pageCount):
(WebCore::PDFDocumentImage::drawPDFPage):
Factored out of draw().
Reduced an unnecessary transform (we were effectively doing mediaBox.origin - cropBox.origin - mediaBox.origin).

* platform/graphics/cg/PDFDocumentImage.h:
Unindent all the things, as we don't indent the first level inside a namespace scope.
Forward-declare PDFDocument.
Make m_currentPage unsigned as it should be.
Add m_hasPage.
Make m_document a PDFDocument on PLATFORM(MAC) and a CGPDFDocumentRef on other platforms.

* platform/graphics/mac/PDFDocumentImageMac.mm: Added.
Soft-link in PDFKit and specifically the PDFDocument class.

(WebCore::PDFDocumentImage::createPDFDocument):
Create our PDFDocument from the SharedBuffer's NSData directly. This shouldn't be a problem
(with respect to the SharedBuffer's data being appended to in secret), because we've waited
for the document to finish loading before getting here.

(WebCore::PDFDocumentImage::computeBoundsForCurrentPage):
Ask PDFKit for the page's media and crop boxes; it automatically performs the correct fallback.
Ask PDFKit for the page's rotation.

(WebCore::PDFDocumentImage::pageCount):
Ask PDFKit for the page count.

(WebCore::PDFDocumentImage::drawPDFPage):
Paint the current page of the PDF. Note that we do not apply the rotation here
via applyRotationForPainting because PDFKit will do it itself.
Save and restore two bits of CG state which aren't saved and restored with the
graphics state, as PDFKit can mutate them above us (<rdar://problem/14951759>).

* platform/mac/SoftLinking.h:
I couldn't find any clients of SOFT_LINK_FRAMEWORK_IN_CORESERVICES_UMBRELLA,
so I made it the more generic SOFT_LINK_FRAMEWORK_IN_UMBRELLA, taking the name
of the umbrella framework and the subframework, so I could use it to soft link
Quartz.framework's PDFKit.framework.

* fast/images/pdf-as-image-with-annotations-expected.html: Added.
* fast/images/pdf-as-image-with-annotations.html: Added.
* fast/images/resources/annotation.pdf: Added.
Add a test that ensures that PDF-in-<img> draws simple annotations.

* platform/mac/fast/images/pdf-as-image-landscape-expected.png:
* platform/mac/fast/images/pdf-as-image-landscape-expected.txt:
Extremely minor rebaselines probably due to PDFKit handling rotation in the new implementation.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155461 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move image-preload-helper.js from LayoutTests/js/resources to LayoutTests/resources.
https://bugs.webkit.org/show_bug.cgi?id=120899.

Rubber stamped by Filip Pizlo.

This was missing from the r155452 commit, and should resolve failures in the
fast/events/mouse-cursor*.html tests.

* js/resources/image-preload-helper.js: Removed.
* resources/image-preload-helper.js: Copied from LayoutTests/js/resources/image-preload-helper.js.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155462 268f45cc-cd09-0410-ab3c-d52691b4dbfc
AX: Expose DOM ID and ClassList to AX APIs for automation and AT element hashes
https://bugs.webkit.org/show_bug.cgi?id=120552

Unreviewed build fix.

* DumpRenderTree/win/AccessibilityUIElementWin.cpp:
(AccessibilityUIElement::classList):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155463 268f45cc-cd09-0410-ab3c-d52691b4dbfc
AX: Integrate Mac results from paragraph-with-linebreaks.html
https://bugs.webkit.org/show_bug.cgi?id=121110

Unreviewed. Add in new expected results for Mac platform.

* platform/mac/accessibility/paragraph-with-linebreaks-expected.txt: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155465 268f45cc-cd09-0410-ab3c-d52691b4dbfc
SpecType should have SpecInt48AsDouble
https://bugs.webkit.org/show_bug.cgi?id=121065

Reviewed by Oliver Hunt.

* bytecode/SpeculatedType.cpp:
(JSC::dumpSpeculation):
(JSC::speculationToAbbreviatedString):
(JSC::speculationFromValue):
* bytecode/SpeculatedType.h:
(JSC::isInt48AsDoubleSpeculation):
(JSC::isIntegerSpeculation):
(JSC::isDoubleRealSpeculation):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155466 268f45cc-cd09-0410-ab3c-d52691b4dbfc