Changeset 61670 in webkit


Ignore:
Timestamp:
Jun 23, 2010 12:30:04 AM (14 years ago)
Author:
yuzo@google.com
Message:

2010-06-23 Yuzo Fujishima <yuzo@google.com>

Reviewed by Shinichiro Hamaji.

Implement page format data programming interface.
https://bugs.webkit.org/show_bug.cgi?id=37538

  • platform/chromium/test_expectations.txt:
  • platform/gtk/Skipped:
  • platform/qt/Skipped:
  • platform/win/Skipped:
  • printing/page-format-data-expected.txt: Added.
  • printing/page-format-data.html: Added.

2010-06-23 Yuzo Fujishima <yuzo@google.com>

Reviewed by Shinichiro Hamaji.

Implement page format data programming interface.
The final goal is to implement CSS Paged Media Module Level 3 (http://dev.w3.org/csswg/css3-page/).
To begin with, this change adds methods to know:

  • if page box is visible,
  • the page area rectangle, and
  • preferred page size.

https://bugs.webkit.org/show_bug.cgi?id=37538

Test: printing/page-format-data.html

  • WebCore.base.exp:
  • css/CSSParser.cpp: (WebCore::CSSParser::parseSizeParameter):
  • css/CSSStyleSelector.cpp: (WebCore::CSSStyleSelector::applyProperty): (WebCore::CSSStyleSelector::applyPageSizeProperty): (WebCore::CSSStyleSelector::pageSizeFromName): (WebCore::CSSStyleSelector::mmLength): (WebCore::CSSStyleSelector::inchLength):
  • css/CSSStyleSelector.h:
  • css/html.css: (@page):
  • dom/Document.cpp: (WebCore::Document::isPageBoxVisible): (WebCore::Document::pageAreaRectInPixels): (WebCore::Document::preferredPageSizeInPixels):
  • dom/Document.h:
  • page/PrintContext.cpp: (WebCore::PrintContext::isPageBoxVisible): (WebCore::PrintContext::pageAreaRectInPixels): (WebCore::PrintContext::preferredPageSizeInPixels):
  • page/PrintContext.h:
  • rendering/style/RenderStyle.h: (WebCore::InheritedFlags::pageSize): (WebCore::InheritedFlags::setPageSize):
  • rendering/style/StyleRareNonInheritedData.h:

2010-06-23 Yuzo Fujishima <yuzo@google.com>

Reviewed by Shinichiro Hamaji.

Implement page format data programming interface.
Add methods for testing.
https://bugs.webkit.org/show_bug.cgi?id=37538

  • Misc/WebCoreStatistics.h:
  • Misc/WebCoreStatistics.mm: (-[WebFrame isPageBoxVisible:]): (-[WebFrame pageAreaRectInPixels:]): (-[WebFrame preferredPageSizeInPixels:]):

2010-06-23 Yuzo Fujishima <yuzo@google.com>

Reviewed by Shinichiro Hamaji.

Implement page format data programming interface.
Add methods for testing.
https://bugs.webkit.org/show_bug.cgi?id=37538

  • DumpRenderTree/LayoutTestController.cpp: (parsePageNumber): (isPageBoxVisibleCallback): (pageAreaRectInPixelsCallback): (preferredPageSizeInPixelsCallback): (LayoutTestController::staticFunctions):
  • DumpRenderTree/LayoutTestController.h:
  • DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: (LayoutTestController::isPageBoxVisible): (LayoutTestController::pageAreaRectInPixels): (LayoutTestController::preferredPageSizeInPixels):
  • DumpRenderTree/mac/LayoutTestControllerMac.mm: (LayoutTestController::isPageBoxVisible): (LayoutTestController::pageAreaRectInPixels): (LayoutTestController::preferredPageSizeInPixels):
  • DumpRenderTree/win/LayoutTestControllerWin.cpp: (LayoutTestController::isPageBoxVisible): (LayoutTestController::pageAreaRectInPixels): (LayoutTestController::preferredPageSizeInPixels):
Location:
trunk
Files:
2 added
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r61669 r61670  
     12010-06-23  Yuzo Fujishima  <yuzo@google.com>
     2
     3        Reviewed by Shinichiro Hamaji.
     4
     5        Implement page format data programming interface.
     6        https://bugs.webkit.org/show_bug.cgi?id=37538
     7
     8        * platform/chromium/test_expectations.txt:
     9        * platform/gtk/Skipped:
     10        * platform/qt/Skipped:
     11        * platform/win/Skipped:
     12        * printing/page-format-data-expected.txt: Added.
     13        * printing/page-format-data.html: Added.
     14
    1152010-06-23  Nikolas Zimmermann  <nzimmermann@rim.com>
    216
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r61656 r61670  
    28852885// Added by r61650
    28862886BUG47259 WIN : http/tests/local/blob/send-data-blob.html = TEXT
     2887
     2888// LayoutTestController::isPageBoxVisible, pageAreaRectInPixels, and preferredPageSizeInPixels are not implemented yet for Chromium.
     2889BUGWK37538 : printing/page-format-data.html = TEXT
     2890
  • trunk/LayoutTests/platform/gtk/Skipped

    r61650 r61670  
    58675867printing/page-rule-selection.html
    58685868
     5869# LayoutTestController::isPageBoxVisible, pageAreaRectInPixels, and preferredPageSizeInPixels are not implemented yet for GTK.
     5870printing/page-format-data.html
     5871
    58695872# Gtk seems to be pumping the lexer an extra time revealed by turning on the
    58705873# HTML5 Lexer in r61234.
  • trunk/LayoutTests/platform/qt/Skipped

    r61657 r61670  
    857857# https://bugs.webkit.org/show_bug.cgi?id=35961
    858858printing/page-rule-selection.html
     859
     860# Missing LayoutTestController::isPageBoxVisible, pageAreaRectInPixels, and preferredPageSizeInPixels.
     861printing/page-format-data.html
    859862
    860863# ============================================================================= #
  • trunk/LayoutTests/platform/win/Skipped

    r61650 r61670  
    933933fast/js/sputnik/Conformance/10_Execution_Contexts/10.2_Entering_An_Execution_Context/10.2.2_Eval_Code/S10.2.2_A1.1_T9.html
    934934fast/js/sputnik/Conformance/10_Execution_Contexts/10.2_Entering_An_Execution_Context/10.2.2_Eval_Code/S10.2.2_A1.2_T9.html
     935
     936# LayoutTestController::isPageBoxVisible, pageAreaRectInPixels, and preferredPageSizeInPixels are not implemented yet for WIN.
     937printing/page-format-data.html
     938
     939
  • trunk/WebCore/ChangeLog

    r61668 r61670  
     12010-06-23  Yuzo Fujishima  <yuzo@google.com>
     2
     3        Reviewed by Shinichiro Hamaji.
     4
     5        Implement page format data programming interface.
     6        The final goal is to implement CSS Paged Media Module Level 3 (http://dev.w3.org/csswg/css3-page/).
     7        To begin with, this change adds methods to know:
     8        - if page box is visible,
     9        - the page area rectangle, and
     10        - preferred page size.
     11
     12        https://bugs.webkit.org/show_bug.cgi?id=37538
     13
     14        Test: printing/page-format-data.html
     15
     16        * WebCore.base.exp:
     17        * css/CSSParser.cpp:
     18        (WebCore::CSSParser::parseSizeParameter):
     19        * css/CSSStyleSelector.cpp:
     20        (WebCore::CSSStyleSelector::applyProperty):
     21        (WebCore::CSSStyleSelector::applyPageSizeProperty):
     22        (WebCore::CSSStyleSelector::pageSizeFromName):
     23        (WebCore::CSSStyleSelector::mmLength):
     24        (WebCore::CSSStyleSelector::inchLength):
     25        * css/CSSStyleSelector.h:
     26        * css/html.css:
     27        (@page):
     28        * dom/Document.cpp:
     29        (WebCore::Document::isPageBoxVisible):
     30        (WebCore::Document::pageAreaRectInPixels):
     31        (WebCore::Document::preferredPageSizeInPixels):
     32        * dom/Document.h:
     33        * page/PrintContext.cpp:
     34        (WebCore::PrintContext::isPageBoxVisible):
     35        (WebCore::PrintContext::pageAreaRectInPixels):
     36        (WebCore::PrintContext::preferredPageSizeInPixels):
     37        * page/PrintContext.h:
     38        * rendering/style/RenderStyle.h:
     39        (WebCore::InheritedFlags::pageSize):
     40        (WebCore::InheritedFlags::setPageSize):
     41        * rendering/style/StyleRareNonInheritedData.h:
     42
    1432010-06-23  Adam Barth  <abarth@webkit.org>
    244
  • trunk/WebCore/WebCore.base.exp

    r61584 r61670  
    251251__ZN7WebCore12PrintContext12pagePropertyEPNS_5FrameEPKci
    252252__ZN7WebCore12PrintContext13numberOfPagesEPNS_5FrameERKNS_9FloatSizeE
     253__ZN7WebCore12PrintContext16isPageBoxVisibleEPNS_5FrameEi
     254__ZN7WebCore12PrintContext20pageAreaRectInPixelsEPNS_5FrameEi
    253255__ZN7WebCore12PrintContext20pageNumberForElementEPNS_7ElementERKNS_9FloatSizeE
     256__ZN7WebCore12PrintContext25preferredPageSizeInPixelsEPNS_5FrameEi
    254257__ZN7WebCore12PrintContext28computePageRectsWithPageSizeERKNS_9FloatSizeEb
    255258__ZN7WebCore12PrintContextC1EPNS_5FrameE
     
    623626__ZN7WebCore8Document13svgExtensionsEv
    624627__ZN7WebCore8Document14setFocusedNodeEN3WTF10PassRefPtrINS_4NodeEEE
     628__ZN7WebCore8Document16isPageBoxVisibleEi
    625629__ZN7WebCore8Document17getFocusableNodesERN3WTF6VectorINS1_6RefPtrINS_4NodeEEELm0EEE
    626630__ZN7WebCore8Document19accessSVGExtensionsEv
     631__ZN7WebCore8Document20pageAreaRectInPixelsEi
    627632__ZN7WebCore8Document22createDocumentFragmentEv
    628633__ZN7WebCore8Document23renderedRectsForMarkersENS_14DocumentMarker10MarkerTypeE
    629634__ZN7WebCore8Document24setShouldCreateRenderersEb
     635__ZN7WebCore8Document25preferredPageSizeInPixelsEi
    630636__ZN7WebCore8Document36updateLayoutIgnorePendingStylesheetsEv
    631637__ZN7WebCore8Document4headEv
  • trunk/WebCore/css/CSSParser.cpp

    r61548 r61670  
    22472247        if (prevParamType == None || prevParamType == Orientation) {
    22482248            // Normalize to Page Size then Orientation order by prepending.
    2249             // This is not specified by the CSS3 Paged Media specification, but for simpler processing hereafter.
     2249            // This is not specified by the CSS3 Paged Media specification, but for simpler processing later (CSSStyleSelector::applyPageSizeProperty).
    22502250            parsedValues->prepend(CSSPrimitiveValue::createIdentifier(value->id));
    22512251            return PageSize;
     
    22532253        return None;
    22542254    case 0:
    2255         if (validUnit(value, FLength, m_strict) && (prevParamType == None || prevParamType == Length)) {
     2255        if (validUnit(value, FLength | FNonNeg, m_strict) && (prevParamType == None || prevParamType == Length)) {
    22562256            parsedValues->append(CSSPrimitiveValue::create(value->fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit)));
    22572257            return Length;
  • trunk/WebCore/css/CSSStyleSelector.cpp

    r61548 r61670  
    3131#include "CSSCursorImageValue.h"
    3232#include "CSSFontFaceRule.h"
     33#include "CSSHelper.h"
    3334#include "CSSImportRule.h"
    3435#include "CSSMediaRule.h"
     
    54585459        }
    54595460        return;
     5461    case CSSPropertySize:
     5462        applyPageSizeProperty(value);
     5463        return;
    54605464    case CSSPropertyInvalid:
    54615465        return;
     
    54635467    case CSSPropertyPage:
    54645468    case CSSPropertyQuotes:
    5465     case CSSPropertySize:
    54665469    case CSSPropertyTextLineThrough:
    54675470    case CSSPropertyTextLineThroughColor:
     
    55095512#endif
    55105513    }
     5514}
     5515
     5516void CSSStyleSelector::applyPageSizeProperty(CSSValue* value)
     5517{
     5518    if (!value->isValueList())
     5519        return;
     5520    CSSValueList* valueList = static_cast<CSSValueList*>(value);
     5521    Length width;
     5522    Length height;
     5523    switch (valueList->length()) {
     5524    case 2: {
     5525        // <length>{2} | <page-size> <orientation>
     5526        if (!valueList->item(0)->isPrimitiveValue() || !valueList->item(1)->isPrimitiveValue())
     5527            return;
     5528        CSSPrimitiveValue* primitiveValue0 = static_cast<CSSPrimitiveValue*>(valueList->item(0));
     5529        CSSPrimitiveValue* primitiveValue1 = static_cast<CSSPrimitiveValue*>(valueList->item(1));
     5530        int type0 = primitiveValue0->primitiveType();
     5531        int type1 = primitiveValue1->primitiveType();
     5532        if (CSSPrimitiveValue::isUnitTypeLength(type0)) {
     5533            // <length>{2}
     5534            if (!CSSPrimitiveValue::isUnitTypeLength(type1))
     5535                return;
     5536            width = Length(primitiveValue0->computeLengthIntForLength(style(), m_rootElementStyle), Fixed);
     5537            height = Length(primitiveValue1->computeLengthIntForLength(style(), m_rootElementStyle), Fixed);
     5538        } else {
     5539            // <page-size> <orientation>
     5540            // The value order is guaranteed. See CSSParser::parseSizeParameter.
     5541            if (!pageSizeFromName(primitiveValue0, primitiveValue1, width, height))
     5542                return;
     5543        }
     5544        break;
     5545    }
     5546    case 1: {
     5547        // <length> | auto | <page-size> | [ portrait | landscape]
     5548        if (!valueList->item(0)->isPrimitiveValue())
     5549            return;
     5550        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(valueList->item(0));
     5551        int type = primitiveValue->primitiveType();
     5552        if (CSSPrimitiveValue::isUnitTypeLength(type)) {
     5553            // <length>
     5554            width = height = Length(primitiveValue->computeLengthIntForLength(style(), m_rootElementStyle), Fixed);
     5555        } else {
     5556            if (type != CSSPrimitiveValue::CSS_IDENT)
     5557                return;
     5558            switch (primitiveValue->getIdent()) {
     5559            case CSSValueAuto:
     5560                // auto
     5561                if (!pageSizeFromName(0, 0, width, height))
     5562                    return;
     5563                break;
     5564            case CSSValuePortrait:
     5565            case CSSValueLandscape:
     5566                // <page-size>
     5567                if (!pageSizeFromName(0, primitiveValue, width, height))
     5568                    return;
     5569                break;
     5570            default:
     5571                // [ portrait | landscape]
     5572                if (!pageSizeFromName(primitiveValue, 0, width, height))
     5573                    return;
     5574            }
     5575        }
     5576        break;
     5577    }
     5578    default:
     5579        return;
     5580    }
     5581    m_style->setPageSize(LengthSize(width, height));
     5582    return;
     5583}
     5584
     5585bool CSSStyleSelector::pageSizeFromName(CSSPrimitiveValue* pageSizeName, CSSPrimitiveValue* pageOrientation, Length& width, Length& height)
     5586{
     5587    static const Length a5Width = mmLength(148), a5Height = mmLength(210);
     5588    static const Length a4Width = mmLength(210), a4Height = mmLength(297);
     5589    static const Length a3Width = mmLength(297), a3Height = mmLength(420);
     5590    static const Length b5Width = mmLength(176), b5Height = mmLength(250);
     5591    static const Length b4Width = mmLength(250), b4Height = mmLength(353);
     5592    static const Length letterWidth = inchLength(8.5), letterHeight = inchLength(11);
     5593    static const Length legalWidth = inchLength(8.5), legalHeight = inchLength(14);
     5594    static const Length ledgerWidth = inchLength(11), ledgerHeight = inchLength(17);
     5595
     5596    // FIXME: Define UA default page size. Assume letter for now.
     5597    int ident = CSSValueLetter;
     5598    if (pageSizeName) {
     5599        if (pageSizeName->primitiveType() != CSSPrimitiveValue::CSS_IDENT)
     5600            return false;
     5601        ident = pageSizeName->getIdent();
     5602    }
     5603
     5604    // FIXME: Define UA default page orientation. Assume portrait for now.
     5605    bool portrait = true;
     5606    if (pageOrientation) {
     5607        if (pageOrientation->primitiveType() != CSSPrimitiveValue::CSS_IDENT)
     5608            return false;
     5609        switch (pageOrientation->getIdent()) {
     5610        case CSSValueLandscape:
     5611            portrait = false;
     5612            break;
     5613        case CSSValuePortrait:
     5614            portrait = true;
     5615            break;
     5616        default:
     5617            return false;
     5618        }
     5619    }
     5620    switch (ident) {
     5621    case CSSValueA5:
     5622        width = a5Width;
     5623        height = a5Height;
     5624        break;
     5625    case CSSValueA4:
     5626        width = a4Width;
     5627        height = a4Height;
     5628        break;
     5629    case CSSValueA3:
     5630        width = a3Width;
     5631        height = a3Height;
     5632        break;
     5633    case CSSValueB5:
     5634        width = b5Width;
     5635        height = b5Height;
     5636        break;
     5637    case CSSValueB4:
     5638        width = b4Width;
     5639        height = b4Height;
     5640        break;
     5641    case CSSValueLetter:
     5642        width = letterWidth;
     5643        height = letterHeight;
     5644        break;
     5645    case CSSValueLegal:
     5646        width = legalWidth;
     5647        height = legalHeight;
     5648        break;
     5649    case CSSValueLedger:
     5650        width = ledgerWidth;
     5651        height = ledgerHeight;
     5652        break;
     5653    default:
     5654        return false;
     5655    }
     5656    if (!portrait)
     5657        swap(width, height);
     5658    return true;
     5659}
     5660
     5661Length CSSStyleSelector::mmLength(double mm)
     5662{
     5663    return Length(CSSPrimitiveValue::create(mm, CSSPrimitiveValue::CSS_MM)->computeLengthIntForLength(style(), m_rootElementStyle), Fixed);
     5664}
     5665
     5666Length CSSStyleSelector::inchLength(double inch)
     5667{
     5668    return Length(CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN)->computeLengthIntForLength(style(), m_rootElementStyle), Fixed);
    55115669}
    55125670
  • trunk/WebCore/css/CSSStyleSelector.h

    r61232 r61670  
    261261
    262262        void applyProperty(int id, CSSValue*);
     263        void applyPageSizeProperty(CSSValue*);
     264        bool pageSizeFromName(CSSPrimitiveValue*, CSSPrimitiveValue*, Length& width, Length& height);
     265        Length mmLength(double mm);
     266        Length inchLength(double inch);
    263267#if ENABLE(SVG)
    264268        void applySVGProperty(int id, CSSValue*);
  • trunk/WebCore/css/html.css

    r61376 r61670  
    728728@page {
    729729    /* FIXME: Define the right default values for page properties. */
     730    size: auto;
    730731    margin: 1in;
    731732}
  • trunk/WebCore/dom/Document.cpp

    r61662 r61670  
    15031503}
    15041504
     1505bool Document::isPageBoxVisible(int pageIndex)
     1506{
     1507    RefPtr<RenderStyle> style = styleForPage(pageIndex);
     1508    return style->visibility() != HIDDEN; // display property doesn't apply to @page.
     1509}
     1510
     1511IntRect Document::pageAreaRectInPixels(int pageIndex)
     1512{
     1513    RefPtr<RenderStyle> style = styleForPage(pageIndex);
     1514    IntSize pageSize = preferredPageSizeInPixels(pageIndex);
     1515    // 100% value for margin-{left,right,top,bottom}. This is used also for top and bottom. http://www.w3.org/TR/CSS2/box.html#value-def-margin-width
     1516    int maxValue = pageSize.width();
     1517    int surroundLeft = style->marginLeft().calcValue(maxValue) + style->borderLeft().width() + style->paddingLeft().calcValue(maxValue);
     1518    int surroundRight = style->marginRight().calcValue(maxValue) + style->borderRight().width() + style->paddingRight().calcValue(maxValue);
     1519    int surroundTop = style->marginTop().calcValue(maxValue) + style->borderTop().width() + style->paddingTop().calcValue(maxValue);
     1520    int surroundBottom = style->marginBottom().calcValue(maxValue) + style->borderBottom().width() + style->paddingBottom().calcValue(maxValue);
     1521    int width = pageSize.width() - surroundLeft - surroundRight;
     1522    int height = pageSize.height() - surroundTop - surroundBottom;
     1523
     1524    return IntRect(surroundLeft, surroundTop, width, height);
     1525}
     1526
     1527IntSize Document::preferredPageSizeInPixels(int pageIndex)
     1528{
     1529    RefPtr<RenderStyle> style = styleForPage(pageIndex);
     1530    LengthSize size = style->pageSize();
     1531    ASSERT(size.width().isFixed());
     1532    ASSERT(size.height().isFixed());
     1533    return IntSize(size.width().calcValue(0), size.height().calcValue(0));
     1534}
     1535
    15051536void Document::createStyleSelector()
    15061537{
  • trunk/WebCore/dom/Document.h

    r61232 r61670  
    484484    PassRefPtr<RenderStyle> styleForElementIgnoringPendingStylesheets(Element*);
    485485    PassRefPtr<RenderStyle> styleForPage(int pageIndex);
     486    bool isPageBoxVisible(int pageIndex);
     487    IntRect pageAreaRectInPixels(int pageIndex);
     488    IntSize preferredPageSizeInPixels(int pageIndex);
    486489    static void updateStyleForAllDocuments(); // FIXME: Try to reduce the # of calls to this function.
    487490    DocLoader* docLoader() { return m_docLoader.get(); }
  • trunk/WebCore/page/PrintContext.cpp

    r61232 r61670  
    219219}
    220220
     221bool PrintContext::isPageBoxVisible(Frame* frame, int pageNumber)
     222{
     223    return frame->document()->isPageBoxVisible(pageNumber);
     224}
     225
     226String PrintContext::pageAreaRectInPixels(Frame* frame, int pageNumber)
     227{
     228    IntRect pageArea = frame->document()->pageAreaRectInPixels(pageNumber);
     229    return String::format("(%d,%d,%d,%d)", pageArea.x(), pageArea.y(), pageArea.width(), pageArea.height());
     230}
     231
     232String PrintContext::preferredPageSizeInPixels(Frame* frame, int pageNumber)
     233{
     234    IntSize pageSize = frame->document()->preferredPageSizeInPixels(pageNumber);
     235    return String::format("(%d,%d)", pageSize.width(), pageSize.height());
     236}
     237
    221238int PrintContext::numberOfPages(Frame* frame, const FloatSize& pageSizeInPixels)
    222239{
  • trunk/WebCore/page/PrintContext.h

    r61232 r61670  
    5757    static int pageNumberForElement(Element*, const FloatSize& pageSizeInPixels);
    5858    static String pageProperty(Frame* frame, const char* propertyName, int pageNumber);
     59    static bool isPageBoxVisible(Frame* frame, int pageNumber);
     60    static String pageAreaRectInPixels(Frame* frame, int pageNumber);
     61    static String preferredPageSizeInPixels(Frame* frame, int pageNumber);
    5962    static int numberOfPages(Frame*, const FloatSize& pageSizeInPixels);
    6063
  • trunk/WebCore/rendering/style/RenderStyle.h

    r61548 r61670  
    704704    Length perspectiveOriginX() const { return rareNonInheritedData->m_perspectiveOriginX; }
    705705    Length perspectiveOriginY() const { return rareNonInheritedData->m_perspectiveOriginY; }
     706    LengthSize pageSize() const { return rareNonInheritedData->m_pageSize; }
    706707   
    707708#if USE(ACCELERATED_COMPOSITING)
     
    10301031    void setPerspectiveOriginX(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginX, l); }
    10311032    void setPerspectiveOriginY(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginY, l); }
     1033    void setPageSize(LengthSize s) { SET_VAR(rareNonInheritedData, m_pageSize, s); }
    10321034
    10331035#if USE(ACCELERATED_COMPOSITING)
  • trunk/WebCore/rendering/style/StyleRareNonInheritedData.h

    r61441 r61670  
    4141class AnimationList;
    4242class CSSStyleSelector;
     43class LengthSize;
    4344class ShadowData;
    4445class StyleFlexibleBoxData;
     
    124125    Length m_perspectiveOriginY;
    125126
     127    LengthSize m_pageSize;
     128
    126129#if ENABLE(XBL)
    127130    OwnPtr<BindingURI> bindingURI; // The XBL binding URI list.
  • trunk/WebKit/mac/ChangeLog

    r61633 r61670  
     12010-06-23  Yuzo Fujishima  <yuzo@google.com>
     2
     3        Reviewed by Shinichiro Hamaji.
     4
     5        Implement page format data programming interface.
     6        Add methods for testing.
     7        https://bugs.webkit.org/show_bug.cgi?id=37538
     8
     9        * Misc/WebCoreStatistics.h:
     10        * Misc/WebCoreStatistics.mm:
     11        (-[WebFrame isPageBoxVisible:]):
     12        (-[WebFrame pageAreaRectInPixels:]):
     13        (-[WebFrame preferredPageSizeInPixels:]):
     14
    1152010-06-22  Anders Carlsson  <andersca@apple.com>
    216
  • trunk/WebKit/mac/Misc/WebCoreStatistics.h

    r61232 r61670  
    8989- (int)numberOfPages:(float)pageWidthInPixels:(float)pageHeightInPixels;
    9090- (NSString *)pageProperty:(const char*)propertyName:(int)pageNumber;
     91- (bool)isPageBoxVisible:(int)pageNumber;
     92- (NSString *)pageAreaRectInPixels:(int)pageNumber;
     93- (NSString *)preferredPageSizeInPixels:(int)pageNumber;
    9194@end
  • trunk/WebKit/mac/Misc/WebCoreStatistics.mm

    r61232 r61670  
    281281}
    282282
     283- (bool)isPageBoxVisible:(int)pageNumber
     284{
     285    return PrintContext::isPageBoxVisible(_private->coreFrame, pageNumber);
     286}
     287
     288- (NSString *)pageAreaRectInPixels:(int)pageNumber
     289{
     290    return PrintContext::pageAreaRectInPixels(_private->coreFrame, pageNumber);
     291}
     292
     293- (NSString *)preferredPageSizeInPixels:(int)pageNumber;
     294{
     295    return PrintContext::preferredPageSizeInPixels(_private->coreFrame, pageNumber);
     296}
    283297@end
  • trunk/WebKitTools/ChangeLog

    r61666 r61670  
     12010-06-23  Yuzo Fujishima  <yuzo@google.com>
     2
     3        Reviewed by Shinichiro Hamaji.
     4
     5        Implement page format data programming interface.
     6        Add methods for testing.
     7        https://bugs.webkit.org/show_bug.cgi?id=37538
     8
     9        * DumpRenderTree/LayoutTestController.cpp:
     10        (parsePageNumber):
     11        (isPageBoxVisibleCallback):
     12        (pageAreaRectInPixelsCallback):
     13        (preferredPageSizeInPixelsCallback):
     14        (LayoutTestController::staticFunctions):
     15        * DumpRenderTree/LayoutTestController.h:
     16        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
     17        (LayoutTestController::isPageBoxVisible):
     18        (LayoutTestController::pageAreaRectInPixels):
     19        (LayoutTestController::preferredPageSizeInPixels):
     20        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
     21        (LayoutTestController::isPageBoxVisible):
     22        (LayoutTestController::pageAreaRectInPixels):
     23        (LayoutTestController::preferredPageSizeInPixels):
     24        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
     25        (LayoutTestController::isPageBoxVisible):
     26        (LayoutTestController::pageAreaRectInPixels):
     27        (LayoutTestController::preferredPageSizeInPixels):
     28
    1292010-06-23  Sam Magnuson  <smagnuson@netflix.com>
    230
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.cpp

    r61599 r61670  
    553553}
    554554
     555static bool parsePageNumber(JSContextRef context, int argumentCount, const JSValueRef* arguments, JSValueRef* exception, int& pageNumber)
     556{
     557    pageNumber = 0;
     558    if (argumentCount != 1)
     559        return false;
     560    pageNumber = static_cast<int>(JSValueToNumber(context, arguments[0], exception));
     561    return !*exception;
     562}
     563
    555564static JSValueRef pageNumberForElementByIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
    556565{
     
    592601    delete[] propertyName;
    593602    return value;
     603}
     604
     605static JSValueRef isPageBoxVisibleCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     606{
     607    int pageNumber = 0;
     608    if (!parsePageNumber(context, argumentCount, arguments, exception, pageNumber))
     609        return JSValueMakeUndefined(context);
     610
     611    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     612    return JSValueMakeBoolean(context, controller->isPageBoxVisible(pageNumber));
     613}
     614
     615static JSValueRef pageAreaRectInPixelsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     616{
     617    int pageNumber = 0;
     618    if (!parsePageNumber(context, argumentCount, arguments, exception, pageNumber))
     619        return JSValueMakeUndefined(context);
     620
     621    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     622    return JSValueMakeString(context, controller->pageAreaRectInPixels(pageNumber).get());
     623}
     624
     625static JSValueRef preferredPageSizeInPixelsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     626{
     627    int pageNumber = 0;
     628    if (!parsePageNumber(context, argumentCount, arguments, exception, pageNumber))
     629        return JSValueMakeUndefined(context);
     630
     631    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     632    return JSValueMakeString(context, controller->preferredPageSizeInPixels(pageNumber).get());
    594633}
    595634
     
    16521691        { "grantDesktopNotificationPermission", grantDesktopNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    16531692        { "isCommandEnabled", isCommandEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1693        { "isPageBoxVisible", isPageBoxVisibleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    16541694        { "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    16551695        { "layerTreeAsText", layerTreeAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     
    16601700        { "overridePreference", overridePreferenceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    16611701        { "pageNumberForElementById", pageNumberForElementByIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1702        { "pageAreaRectInPixels", pageAreaRectInPixelsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    16621703        { "pageProperty", pagePropertyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    16631704        { "pathToLocalResource", pathToLocalResourceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    16641705        { "pauseAnimationAtTimeOnElementWithId", pauseAnimationAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    16651706        { "pauseTransitionAtTimeOnElementWithId", pauseTransitionAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1707        { "preferredPageSizeInPixels", preferredPageSizeInPixelsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    16661708        { "sampleSVGAnimationForElementAtTime", sampleSVGAnimationForElementAtTimeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    16671709        { "printToPDF", dumpAsPDFCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.h

    r61599 r61670  
    6565    int pageNumberForElementById(JSStringRef id, float pageWidthInPixels, float pageHeightInPixels);
    6666    JSRetainPtr<JSStringRef> pageProperty(const char* propertyName, int pageNumber) const;
     67    bool isPageBoxVisible(int pageNumber) const;
     68    JSRetainPtr<JSStringRef> pageAreaRectInPixels(int pageNumber) const;
     69    JSRetainPtr<JSStringRef> preferredPageSizeInPixels(int pageNumber) const;
    6770    JSStringRef pathToLocalResource(JSContextRef, JSStringRef url);
    6871    void queueBackNavigation(int howFarBackward);
  • trunk/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp

    r61232 r61670  
    178178}
    179179
     180bool LayoutTestController::isPageBoxVisible(int pageNumber) const
     181{
     182    // FIXME: implement
     183    return false;
     184}
     185
     186JSRetainPtr<JSStringRef> LayoutTestController::pageAreaRectInPixels(int pageNumber) const
     187{
     188    // FIXME: implement
     189    return JSRetainPtr<JSStringRef>();
     190}
     191
     192JSRetainPtr<JSStringRef> LayoutTestController::preferredPageSizeInPixels(int pageNumber) const
     193{
     194    // FIXME: implement
     195    return JSRetainPtr<JSStringRef>();
     196}
     197
    180198size_t LayoutTestController::webHistoryItemCount()
    181199{
  • trunk/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm

    r61599 r61670  
    219219}
    220220
     221bool LayoutTestController::isPageBoxVisible(int pageNumber) const
     222{
     223    return [mainFrame isPageBoxVisible:pageNumber];
     224}
     225
     226JSRetainPtr<JSStringRef> LayoutTestController::pageAreaRectInPixels(int pageNumber) const
     227{
     228    JSRetainPtr<JSStringRef> propertyValue(Adopt, JSStringCreateWithCFString((CFStringRef)[mainFrame pageAreaRectInPixels:pageNumber]));
     229    return propertyValue;
     230}
     231
     232JSRetainPtr<JSStringRef> LayoutTestController::preferredPageSizeInPixels(int pageNumber) const
     233{
     234    JSRetainPtr<JSStringRef> propertyValue(Adopt, JSStringCreateWithCFString((CFStringRef)[mainFrame preferredPageSizeInPixels:pageNumber]));
     235    return propertyValue;
     236}
     237
    221238int LayoutTestController::numberOfPages(float pageWidthInPixels, float pageHeightInPixels)
    222239{
  • trunk/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp

    r61232 r61670  
    12491249}
    12501250
     1251bool LayoutTestController::isPageBoxVisible(int pageNumber) const
     1252{
     1253    // FIXME: implement
     1254    return false;
     1255}
     1256
     1257JSRetainPtr<JSStringRef> LayoutTestController::pageAreaRectInPixels(int pageNumber) const
     1258{
     1259    // FIXME: implement
     1260    return JSRetainPtr<JSStringRef>();
     1261}
     1262
     1263JSRetainPtr<JSStringRef> LayoutTestController::preferredPageSizeInPixels(int pageNumber) const
     1264{
     1265    // FIXME: implement
     1266    return JSRetainPtr<JSStringRef>();
     1267}
     1268
    12511269void LayoutTestController::apiTestGoToCurrentBackForwardItem()
    12521270{
Note: See TracChangeset for help on using the changeset viewer.