Changeset 58386 in webkit


Ignore:
Timestamp:
Apr 28, 2010 12:30:16 AM (14 years ago)
Author:
hamaji@chromium.org
Message:

2010-04-27 Shinichiro Hamaji <hamaji@chromium.org>

Reviewed by Darin Adler and Eric Seidel.

Add layoutTestController.setPrinting()
https://bugs.webkit.org/show_bug.cgi?id=37203

Now we can test media queries with the new function because the
render tree has the color information of the box.

Note that the pixel test is currently failing. We'll need another
patch to enable printing mode for pixel tests.

  • platform/mac/Skipped:
  • platform/mac/printing/media-queries-print-expected.checksum: Added.
  • platform/mac/printing/media-queries-print-expected.png: Added.
  • platform/mac/printing/media-queries-print-expected.txt: Added.
  • printing/media-queries-print.html:

2010-04-27 Shinichiro Hamaji <hamaji@chromium.org>

Reviewed by Darin Adler and Eric Seidel.

Add layoutTestController.setPrinting()
https://bugs.webkit.org/show_bug.cgi?id=37203

Added RenderAsTextPrintingMode as a behavior of externalRepresentation.

Now ~PrintContext() calls end() automatically.

  • page/PrintContext.cpp: (WebCore::PrintContext::~PrintContext):
  • rendering/RenderTreeAsText.cpp: (WebCore::externalRepresentation):
  • rendering/RenderTreeAsText.h: (WebCore::):

2010-04-27 Shinichiro Hamaji <hamaji@chromium.org>

Reviewed by Darin Adler and Eric Seidel.

Add layoutTestController.setPrinting()
https://bugs.webkit.org/show_bug.cgi?id=37203

  • Misc/WebCoreStatistics.h:
  • Misc/WebCoreStatistics.mm: (-[WebFrame renderTreeAsExternalRepresentationForPrinting:]):

2010-04-27 Shinichiro Hamaji <hamaji@chromium.org>

Reviewed by Darin Adler and Eric Seidel.

Add layoutTestController.setPrinting()
https://bugs.webkit.org/show_bug.cgi?id=37203

  • DumpRenderTree/LayoutTestController.cpp: (LayoutTestController::LayoutTestController): (setPrintingCallback): (LayoutTestController::staticFunctions):
  • DumpRenderTree/LayoutTestController.h: (LayoutTestController::isPrinting): (LayoutTestController::setIsPrinting):
  • DumpRenderTree/mac/DumpRenderTree.mm: (dump):
Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r58385 r58386  
     12010-04-27  Shinichiro Hamaji  <hamaji@chromium.org>
     2
     3        Reviewed by Darin Adler and Eric Seidel.
     4
     5        Add layoutTestController.setPrinting()
     6        https://bugs.webkit.org/show_bug.cgi?id=37203
     7
     8        Now we can test media queries with the new function because the
     9        render tree has the color information of the box.
     10
     11        Note that the pixel test is currently failing. We'll need another
     12        patch to enable printing mode for pixel tests.
     13
     14        * platform/mac/Skipped:
     15        * platform/mac/printing/media-queries-print-expected.checksum: Added.
     16        * platform/mac/printing/media-queries-print-expected.png: Added.
     17        * platform/mac/printing/media-queries-print-expected.txt: Added.
     18        * printing/media-queries-print.html:
     19
    1202010-04-27  Yuzo Fujishima  <yuzo@google.com>
    221
  • trunk/LayoutTests/platform/mac/Skipped

    r58111 r58386  
    3838# see bug https://bugs.webkit.org/show_bug.cgi?id=20011 -- Printing tests should use ImageDiff
    3939printing/compositing-layer-printing.html
    40 printing/media-queries-print.html
    4140
    4241# Skip because fix for https://bugs.webkit.org/show_bug.cgi?id=26770 was reverted
  • trunk/LayoutTests/printing/media-queries-print.html

    r35078 r58386  
    1717<script>
    1818  if (window.layoutTestController)
    19     layoutTestController.printToPDF();
     19    layoutTestController.setPrinting();
    2020</script>
    2121<body>
  • trunk/WebCore/ChangeLog

    r58385 r58386  
     12010-04-27  Shinichiro Hamaji  <hamaji@chromium.org>
     2
     3        Reviewed by Darin Adler and Eric Seidel.
     4
     5        Add layoutTestController.setPrinting()
     6        https://bugs.webkit.org/show_bug.cgi?id=37203
     7
     8        Added RenderAsTextPrintingMode as a behavior of externalRepresentation.
     9
     10        Now ~PrintContext() calls end() automatically.
     11
     12        * page/PrintContext.cpp:
     13        (WebCore::PrintContext::~PrintContext):
     14        * rendering/RenderTreeAsText.cpp:
     15        (WebCore::externalRepresentation):
     16        * rendering/RenderTreeAsText.h:
     17        (WebCore::):
     18
    1192010-04-27  Yuzo Fujishima  <yuzo@google.com>
    220
  • trunk/WebCore/page/PrintContext.cpp

    r57384 r58386  
    3939PrintContext::~PrintContext()
    4040{
    41     ASSERT(!m_isPrinting);
     41    if (m_isPrinting)
     42        end();
    4243    m_pageRects.clear();
    4344}
  • trunk/WebCore/rendering/RenderTreeAsText.cpp

    r58212 r58386  
    3535#include "HTMLNames.h"
    3636#include "InlineTextBox.h"
     37#include "PrintContext.h"
    3738#include "RenderBR.h"
    3839#include "RenderFileUploadControl.h"
     
    4445#include "RenderView.h"
    4546#include "RenderWidget.h"
     47#include "Screen.h"
    4648#include "SelectionController.h"
    4749#include "TextStream.h"
     
    618620String externalRepresentation(Frame* frame, RenderAsTextBehavior behavior)
    619621{
     622    PrintContext printContext(frame);
     623    if (behavior & RenderAsTextPrintingMode)
     624        printContext.begin(frame->domWindow()->screen()->width());
     625
    620626    frame->document()->updateLayout();
    621627
  • trunk/WebCore/rendering/RenderTreeAsText.h

    r57986 r58386  
    4040    RenderAsTextShowLayerNesting = 1 << 1, // Annotate the layer lists.
    4141    RenderAsTextShowCompositedLayers = 1 << 2, // Show which layers are composited.
    42     RenderAsTextShowAddresses = 1 << 3 // Show layer and renderer addresses.
     42    RenderAsTextShowAddresses = 1 << 3, // Show layer and renderer addresses.
     43    RenderAsTextPrintingMode = 1 << 4 // Dump the tree in printing mode.
    4344};
    4445typedef unsigned RenderAsTextBehavior;
    4546
     47// You don't need pageWidthInPixels if you don't specify RenderAsTextInPrintingMode.
    4648String externalRepresentation(Frame*, RenderAsTextBehavior = RenderAsTextBehaviorNormal);
    4749void write(TextStream&, const RenderObject&, int indent = 0, RenderAsTextBehavior = RenderAsTextBehaviorNormal);
  • trunk/WebKit/mac/ChangeLog

    r58266 r58386  
     12010-04-27  Shinichiro Hamaji  <hamaji@chromium.org>
     2
     3        Reviewed by Darin Adler and Eric Seidel.
     4
     5        Add layoutTestController.setPrinting()
     6        https://bugs.webkit.org/show_bug.cgi?id=37203
     7
     8        * Misc/WebCoreStatistics.h:
     9        * Misc/WebCoreStatistics.mm:
     10        (-[WebFrame renderTreeAsExternalRepresentationForPrinting:]):
     11
    1122010-04-25  Sam Weinig  <sam@webkit.org>
    213
  • trunk/WebKit/mac/Misc/WebCoreStatistics.h

    r54672 r58386  
    8484
    8585@interface WebFrame (WebKitDebug)
    86 - (NSString *)renderTreeAsExternalRepresentation;
     86- (NSString *)renderTreeAsExternalRepresentationForPrinting:(BOOL)forPrinting;
    8787- (NSString *)counterValueForElement:(DOMElement*)element;
    8888- (int)pageNumberForElement:(DOMElement*)element:(float)pageWidthInPixels:(float)pageHeightInPixels;
  • trunk/WebKit/mac/Misc/WebCoreStatistics.mm

    r55750 r58386  
    256256@implementation WebFrame (WebKitDebug)
    257257
    258 - (NSString *)renderTreeAsExternalRepresentation
    259 {
    260     return externalRepresentation(_private->coreFrame);
     258- (NSString *)renderTreeAsExternalRepresentationForPrinting:(BOOL)forPrinting
     259{
     260    return externalRepresentation(_private->coreFrame, forPrinting ? RenderAsTextPrintingMode : RenderAsTextBehaviorNormal);
    261261}
    262262
  • trunk/WebKitTools/ChangeLog

    r58380 r58386  
     12010-04-27  Shinichiro Hamaji  <hamaji@chromium.org>
     2
     3        Reviewed by Darin Adler and Eric Seidel.
     4
     5        Add layoutTestController.setPrinting()
     6        https://bugs.webkit.org/show_bug.cgi?id=37203
     7
     8        * DumpRenderTree/LayoutTestController.cpp:
     9        (LayoutTestController::LayoutTestController):
     10        (setPrintingCallback):
     11        (LayoutTestController::staticFunctions):
     12        * DumpRenderTree/LayoutTestController.h:
     13        (LayoutTestController::isPrinting):
     14        (LayoutTestController::setIsPrinting):
     15        * DumpRenderTree/mac/DumpRenderTree.mm:
     16        (dump):
     17
    1182010-04-27  Michael Nordman  <michaeln@google.com>
    219
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.cpp

    r58111 r58386  
    7777    , m_geolocationPermission(false)
    7878    , m_handlesAuthenticationChallenges(false)
     79    , m_isPrinting(false)
    7980    , m_testPathOrURL(testPathOrURL)
    8081    , m_expectedPixelHash(expectedPixelHash)
     
    957958    controller->setSpatialNavigationEnabled(JSValueToBoolean(context, arguments[0]));
    958959
     960    return JSValueMakeUndefined(context);
     961}
     962
     963static JSValueRef setPrintingCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     964{
     965    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     966    controller->setIsPrinting(true);
    959967    return JSValueMakeUndefined(context);
    960968}
     
    15831591        { "setPersistentUserStyleSheetLocation", setPersistentUserStyleSheetLocationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    15841592        { "setPopupBlockingEnabled", setPopupBlockingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1593        { "setPrinting", setPrintingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    15851594        { "setPrivateBrowsingEnabled", setPrivateBrowsingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    15861595        { "setSelectTrailingWhitespaceEnabled", setSelectTrailingWhitespaceEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.h

    r58111 r58386  
    212212    void setHandlesAuthenticationChallenges(bool handlesAuthenticationChallenges) { m_handlesAuthenticationChallenges = handlesAuthenticationChallenges; }
    213213   
     214    bool isPrinting() const { return m_isPrinting; }
     215    void setIsPrinting(bool isPrinting) { m_isPrinting = isPrinting; }
     216
    214217    const std::string& authenticationUsername() const { return m_authenticationUsername; }
    215218    void setAuthenticationUsername(std::string username) { m_authenticationUsername = username; }
     
    302305    bool m_geolocationPermission;
    303306    bool m_handlesAuthenticationChallenges;
     307    bool m_isPrinting;
    304308
    305309    std::string m_authenticationUsername;
  • trunk/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm

    r58072 r58386  
    10861086        } else {
    10871087            sizeWebViewForCurrentTest();
    1088             resultString = [mainFrame renderTreeAsExternalRepresentation];
     1088            resultString = [mainFrame renderTreeAsExternalRepresentationForPrinting:gLayoutTestController->isPrinting()];
    10891089        }
    10901090
     
    11171117
    11181118    if (dumpPixels && !dumpAsText)
     1119        // FIXME: when isPrinting is set, dump the image with page separators.
    11191120        dumpWebViewAsPixelsAndCompareWithExpected(gLayoutTestController->expectedPixelHash());
    11201121
Note: See TracChangeset for help on using the changeset viewer.