Changeset 162118 in webkit
- Timestamp:
- Jan 15, 2014 11:37:46 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r162117 r162118 1 2014-01-15 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK][EFL][NIX] Do not use PrintContext, Frame and DocumentLoader in Errors 4 https://bugs.webkit.org/show_bug.cgi?id=127047 5 6 Reviewed by Martin Robinson. 7 8 Using PrintContext, Frame and DocumentLoader in platform is a 9 layering violation. 10 Change printing error methods to receive a failing URL instead of 11 receiving a PrintContext that was used only to get the failing 12 URL. 13 14 * platform/efl/ErrorsEfl.cpp: 15 (WebCore::printError): 16 (WebCore::printerNotFoundError): 17 (WebCore::invalidPageRangeToPrint): 18 * platform/efl/ErrorsEfl.h: 19 * platform/gtk/ErrorsGtk.cpp: 20 (WebCore::printError): 21 (WebCore::printerNotFoundError): 22 (WebCore::invalidPageRangeToPrint): 23 * platform/gtk/ErrorsGtk.h: 24 * platform/nix/ErrorsNix.cpp: 25 (WebCore::printError): 26 (WebCore::printerNotFoundError): 27 (WebCore::invalidPageRangeToPrint): 28 * platform/nix/ErrorsNix.h: 29 1 30 2014-01-15 Mihnea Ovidenie <mihnea@adobe.com> 2 31 -
trunk/Source/WebCore/platform/efl/ErrorsEfl.cpp
r156550 r162118 27 27 #include "ErrorsEfl.h" 28 28 29 #include "DocumentLoader.h"30 #include "Frame.h"31 #include "FrameLoader.h"32 #include "PrintContext.h"33 29 #include "ResourceError.h" 34 30 #include "ResourceRequest.h" … … 87 83 } 88 84 89 ResourceError printError(const PrintContext* printContext, const String& errorMessage)85 ResourceError printError(const URL& failingURL, const String& errorMessage) 90 86 { 91 DocumentLoader* documentLoader = printContext->frame()->loader().documentLoader(); 92 93 return ResourceError(errorDomainPrint, PrintErrorGeneral, documentLoader ? documentLoader->url() : URL(), errorMessage); 87 return ResourceError(errorDomainPrint, PrintErrorGeneral, failingURL, errorMessage); 94 88 } 95 89 96 ResourceError printerNotFoundError(const PrintContext* printContext)90 ResourceError printerNotFoundError(const URL& failingURL) 97 91 { 98 DocumentLoader* documentLoader = printContext->frame()->loader().documentLoader(); 99 100 return ResourceError(errorDomainPrint, PrintErrorPrinterNotFound, documentLoader ? documentLoader->url() : URL(), ASCIILiteral("Printer not found")); 92 return ResourceError(errorDomainPrint, PrintErrorPrinterNotFound, failingURL, ASCIILiteral("Printer not found")); 101 93 } 102 94 103 ResourceError invalidPageRangeToPrint(const PrintContext* printContext)95 ResourceError invalidPageRangeToPrint(const URL& failingURL) 104 96 { 105 DocumentLoader* documentLoader = printContext->frame()->loader().documentLoader(); 106 107 return ResourceError(errorDomainPrint, PrintErrorInvalidPageRange, documentLoader ? documentLoader->url() : URL(), ASCIILiteral("Invalid page range")); 97 return ResourceError(errorDomainPrint, PrintErrorInvalidPageRange, failingURL, ASCIILiteral("Invalid page range")); 108 98 } 109 99 -
trunk/Source/WebCore/platform/efl/ErrorsEfl.h
r127757 r162118 31 31 namespace WebCore { 32 32 33 class PrintContext;34 33 class ResourceError; 35 34 class ResourceRequest; 36 35 class ResourceResponse; 36 class URL; 37 37 38 38 static const char errorDomainNetwork[] = "WebKitNetworkError"; … … 91 91 ResourceError downloadCancelledByUserError(const ResourceResponse&); 92 92 ResourceError downloadDestinationError(const ResourceResponse&, const String& errorMessage); 93 ResourceError printError(const PrintContext*, const String& errorMessage);94 ResourceError printerNotFoundError(const PrintContext*);95 ResourceError invalidPageRangeToPrint(const PrintContext*);93 ResourceError printError(const URL& failingURL, const String& errorMessage); 94 ResourceError printerNotFoundError(const URL& failingURL); 95 ResourceError invalidPageRangeToPrint(const URL& failingURL); 96 96 97 97 } -
trunk/Source/WebCore/platform/gtk/ErrorsGtk.cpp
r156550 r162118 21 21 #include "ErrorsGtk.h" 22 22 23 #include "DocumentLoader.h"24 #include "Frame.h"25 #include "FrameLoader.h"26 #include "PrintContext.h"27 23 #include "ResourceError.h" 28 24 #include "ResourceRequest.h" … … 92 88 } 93 89 94 ResourceError printError(const PrintContext* printContext, const String& errorMessage)90 ResourceError printError(const URL& failingURL, const String& errorMessage) 95 91 { 96 DocumentLoader* documentLoader = printContext->frame()->loader().documentLoader(); 97 return ResourceError(errorDomainPrint, PrintErrorGeneral, 98 documentLoader ? documentLoader->url() : URL(), errorMessage); 92 return ResourceError(errorDomainPrint, PrintErrorGeneral, failingURL, errorMessage); 99 93 } 100 94 101 ResourceError printerNotFoundError(const PrintContext* printContext)95 ResourceError printerNotFoundError(const URL& failingURL) 102 96 { 103 DocumentLoader* documentLoader = printContext->frame()->loader().documentLoader(); 104 return ResourceError(errorDomainPrint, PrintErrorPrinterNotFound, 105 documentLoader ? documentLoader->url() : URL(), _("Printer not found")); 97 return ResourceError(errorDomainPrint, PrintErrorPrinterNotFound, failingURL, _("Printer not found")); 106 98 } 107 99 108 ResourceError invalidPageRangeToPrint(const PrintContext* printContext)100 ResourceError invalidPageRangeToPrint(const URL& failingURL) 109 101 { 110 DocumentLoader* documentLoader = printContext->frame()->loader().documentLoader(); 111 return ResourceError(errorDomainPrint, PrintErrorInvalidPageRange, 112 documentLoader ? documentLoader->url() : URL(), _("Invalid page range")); 102 return ResourceError(errorDomainPrint, PrintErrorInvalidPageRange, failingURL, _("Invalid page range")); 113 103 } 114 104 -
trunk/Source/WebCore/platform/gtk/ErrorsGtk.h
r127757 r162118 25 25 namespace WebCore { 26 26 27 class PrintContext;28 27 class ResourceError; 29 28 class ResourceRequest; 30 29 class ResourceResponse; 30 class URL; 31 31 32 32 const char* const errorDomainNetwork = "WebKitNetworkError"; … … 84 84 ResourceError downloadCancelledByUserError(const ResourceResponse&); 85 85 ResourceError downloadDestinationError(const ResourceResponse&, const String& errorMessage); 86 ResourceError printError(const PrintContext*, const String& errorMessage);87 ResourceError printerNotFoundError(const PrintContext*);88 ResourceError invalidPageRangeToPrint(const PrintContext*);86 ResourceError printError(const URL& failingURL, const String& errorMessage); 87 ResourceError printerNotFoundError(const URL& failingURL); 88 ResourceError invalidPageRangeToPrint(const URL& failingURL); 89 89 90 90 } -
trunk/Source/WebCore/platform/nix/ErrorsNix.cpp
r160001 r162118 28 28 #include "ErrorsNix.h" 29 29 30 #include "DocumentLoader.h"31 #include "Frame.h"32 #include "PrintContext.h"33 30 #include "ResourceError.h" 34 31 #include "ResourceRequest.h" … … 87 84 } 88 85 89 ResourceError printError(const PrintContext* printContext, const String& errorMessage)86 ResourceError printError(const URL& failingURL, const String& errorMessage) 90 87 { 91 DocumentLoader* documentLoader = printContext->frame()->loader().documentLoader(); 92 93 return ResourceError(errorDomainPrint, PrintErrorGeneral, documentLoader ? documentLoader->url() : URL(), errorMessage); 88 return ResourceError(errorDomainPrint, PrintErrorGeneral, failingURL, errorMessage); 94 89 } 95 90 96 ResourceError printerNotFoundError(const PrintContext* printContext)91 ResourceError printerNotFoundError(const URL& failingURL) 97 92 { 98 DocumentLoader* documentLoader = printContext->frame()->loader().documentLoader(); 99 100 return ResourceError(errorDomainPrint, PrintErrorPrinterNotFound, documentLoader ? documentLoader->url() : URL(), ASCIILiteral("Printer not found")); 93 return ResourceError(errorDomainPrint, PrintErrorPrinterNotFound, failingURL, ASCIILiteral("Printer not found")); 101 94 } 102 95 103 ResourceError invalidPageRangeToPrint(const PrintContext* printContext)96 ResourceError invalidPageRangeToPrint(const URL& failingURL) 104 97 { 105 DocumentLoader* documentLoader = printContext->frame()->loader().documentLoader(); 106 107 return ResourceError(errorDomainPrint, PrintErrorInvalidPageRange, documentLoader ? documentLoader->url() : URL(), ASCIILiteral("Invalid page range")); 98 return ResourceError(errorDomainPrint, PrintErrorInvalidPageRange, failingURL, ASCIILiteral("Invalid page range")); 108 99 } 109 100 -
trunk/Source/WebCore/platform/nix/ErrorsNix.h
r160001 r162118 32 32 namespace WebCore { 33 33 34 class PrintContext;35 34 class ResourceError; 36 35 class ResourceRequest; 37 36 class ResourceResponse; 37 class URL; 38 38 39 39 static const char errorDomainNetwork[] = "WebKitNetworkError"; … … 92 92 ResourceError downloadCancelledByUserError(const ResourceResponse&); 93 93 ResourceError downloadDestinationError(const ResourceResponse&, const String& errorMessage); 94 ResourceError printError(const PrintContext*, const String& errorMessage);95 ResourceError printerNotFoundError(const PrintContext*);96 ResourceError invalidPageRangeToPrint(const PrintContext*);94 ResourceError printError(const URL& failingURL, const String& errorMessage); 95 ResourceError printerNotFoundError(const URL& failingURL); 96 ResourceError invalidPageRangeToPrint(const URL& failingURL); 97 97 98 98 } // namespace WebCore -
trunk/Source/WebKit2/ChangeLog
r162114 r162118 1 2014-01-15 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK][EFL][NIX] Do not use PrintContext, Frame and DocumentLoader in Errors 4 https://bugs.webkit.org/show_bug.cgi?id=127047 5 6 Reviewed by Martin Robinson. 7 8 * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp: 9 (WebKit::WebPrintOperationGtk::frameURL): Helper function to get 10 the URL of the frame being printed. 11 (WebKit::WebPrintOperationGtk::print): Use frameURL() as failing 12 URL for printing errors. 13 * WebProcess/WebPage/gtk/WebPrintOperationGtk.h: 14 1 15 2014-01-15 Benjamin Poulain <bpoulain@apple.com> 2 16 -
trunk/Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp
r162073 r162118 30 30 #include "WebPage.h" 31 31 #include "WebPageProxyMessages.h" 32 #include <WebCore/DocumentLoader.h> 32 33 #include <WebCore/ErrorsGtk.h> 34 #include <WebCore/Frame.h> 33 35 #include <WebCore/IntRect.h> 34 36 #include <WebCore/NotImplemented.h> … … 36 38 #include <WebCore/PrintContext.h> 37 39 #include <WebCore/ResourceError.h> 40 #include <WebCore/URL.h> 38 41 #include <gtk/gtk.h> 39 42 #include <wtf/Vector.h> … … 67 70 GtkPrinter* printer = printerName ? printerList->findPrinter(printerName) : printerList->defaultPrinter(); 68 71 if (!printer) { 69 printDone(printerNotFoundError( m_printContext));72 printDone(printerNotFoundError(frameURL())); 70 73 return; 71 74 } … … 79 82 cairo_surface_t* surface = gtk_print_job_get_surface(m_printJob.get(), &error.outPtr()); 80 83 if (!surface) { 81 printDone(printError( m_printContext, error->message));84 printDone(printError(frameURL(), error->message)); 82 85 return; 83 86 } … … 138 141 static void printJobComplete(GtkPrintJob* printJob, WebPrintOperationGtkUnix* printOperation, const GError* error) 139 142 { 140 printOperation->printDone(error ? printError(printOperation-> m_printContext, error->message) : WebCore::ResourceError());143 printOperation->printDone(error ? printError(printOperation->frameURL(), error->message) : WebCore::ResourceError()); 141 144 printOperation->m_printJob = 0; 142 145 } … … 428 431 } 429 432 433 WebCore::URL WebPrintOperationGtk::frameURL() const 434 { 435 if (!m_printContext) 436 return WebCore::URL(); 437 438 WebCore::DocumentLoader* documentLoader = m_printContext->frame()->loader().documentLoader(); 439 return documentLoader ? documentLoader->url() : WebCore::URL(); 440 } 441 430 442 void WebPrintOperationGtk::rotatePageIfNeeded() 431 443 { … … 694 706 if (!data->isValid) { 695 707 cairo_surface_finish(surface); 696 printDone(invalidPageRangeToPrint( m_printContext));708 printDone(invalidPageRangeToPrint(frameURL())); 697 709 return; 698 710 } -
trunk/Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.h
r159042 r162118 40 40 class PrintContext; 41 41 class ResourceError; 42 class URL; 42 43 }; 43 44 … … 93 94 void printPagesDone(); 94 95 void printDone(const WebCore::ResourceError&); 96 WebCore::URL frameURL() const; 95 97 96 98 WebPage* m_webPage;
Note: See TracChangeset
for help on using the changeset viewer.