Changeset 61670 in webkit
- Timestamp:
- Jun 23, 2010 12:30:04 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r61669 r61670 1 2010-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 1 15 2010-06-23 Nikolas Zimmermann <nzimmermann@rim.com> 2 16 -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r61656 r61670 2885 2885 // Added by r61650 2886 2886 BUG47259 WIN : http/tests/local/blob/send-data-blob.html = TEXT 2887 2888 // LayoutTestController::isPageBoxVisible, pageAreaRectInPixels, and preferredPageSizeInPixels are not implemented yet for Chromium. 2889 BUGWK37538 : printing/page-format-data.html = TEXT 2890 -
trunk/LayoutTests/platform/gtk/Skipped
r61650 r61670 5867 5867 printing/page-rule-selection.html 5868 5868 5869 # LayoutTestController::isPageBoxVisible, pageAreaRectInPixels, and preferredPageSizeInPixels are not implemented yet for GTK. 5870 printing/page-format-data.html 5871 5869 5872 # Gtk seems to be pumping the lexer an extra time revealed by turning on the 5870 5873 # HTML5 Lexer in r61234. -
trunk/LayoutTests/platform/qt/Skipped
r61657 r61670 857 857 # https://bugs.webkit.org/show_bug.cgi?id=35961 858 858 printing/page-rule-selection.html 859 860 # Missing LayoutTestController::isPageBoxVisible, pageAreaRectInPixels, and preferredPageSizeInPixels. 861 printing/page-format-data.html 859 862 860 863 # ============================================================================= # -
trunk/LayoutTests/platform/win/Skipped
r61650 r61670 933 933 fast/js/sputnik/Conformance/10_Execution_Contexts/10.2_Entering_An_Execution_Context/10.2.2_Eval_Code/S10.2.2_A1.1_T9.html 934 934 fast/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. 937 printing/page-format-data.html 938 939 -
trunk/WebCore/ChangeLog
r61668 r61670 1 2010-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 1 43 2010-06-23 Adam Barth <abarth@webkit.org> 2 44 -
trunk/WebCore/WebCore.base.exp
r61584 r61670 251 251 __ZN7WebCore12PrintContext12pagePropertyEPNS_5FrameEPKci 252 252 __ZN7WebCore12PrintContext13numberOfPagesEPNS_5FrameERKNS_9FloatSizeE 253 __ZN7WebCore12PrintContext16isPageBoxVisibleEPNS_5FrameEi 254 __ZN7WebCore12PrintContext20pageAreaRectInPixelsEPNS_5FrameEi 253 255 __ZN7WebCore12PrintContext20pageNumberForElementEPNS_7ElementERKNS_9FloatSizeE 256 __ZN7WebCore12PrintContext25preferredPageSizeInPixelsEPNS_5FrameEi 254 257 __ZN7WebCore12PrintContext28computePageRectsWithPageSizeERKNS_9FloatSizeEb 255 258 __ZN7WebCore12PrintContextC1EPNS_5FrameE … … 623 626 __ZN7WebCore8Document13svgExtensionsEv 624 627 __ZN7WebCore8Document14setFocusedNodeEN3WTF10PassRefPtrINS_4NodeEEE 628 __ZN7WebCore8Document16isPageBoxVisibleEi 625 629 __ZN7WebCore8Document17getFocusableNodesERN3WTF6VectorINS1_6RefPtrINS_4NodeEEELm0EEE 626 630 __ZN7WebCore8Document19accessSVGExtensionsEv 631 __ZN7WebCore8Document20pageAreaRectInPixelsEi 627 632 __ZN7WebCore8Document22createDocumentFragmentEv 628 633 __ZN7WebCore8Document23renderedRectsForMarkersENS_14DocumentMarker10MarkerTypeE 629 634 __ZN7WebCore8Document24setShouldCreateRenderersEb 635 __ZN7WebCore8Document25preferredPageSizeInPixelsEi 630 636 __ZN7WebCore8Document36updateLayoutIgnorePendingStylesheetsEv 631 637 __ZN7WebCore8Document4headEv -
trunk/WebCore/css/CSSParser.cpp
r61548 r61670 2247 2247 if (prevParamType == None || prevParamType == Orientation) { 2248 2248 // 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). 2250 2250 parsedValues->prepend(CSSPrimitiveValue::createIdentifier(value->id)); 2251 2251 return PageSize; … … 2253 2253 return None; 2254 2254 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)) { 2256 2256 parsedValues->append(CSSPrimitiveValue::create(value->fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit))); 2257 2257 return Length; -
trunk/WebCore/css/CSSStyleSelector.cpp
r61548 r61670 31 31 #include "CSSCursorImageValue.h" 32 32 #include "CSSFontFaceRule.h" 33 #include "CSSHelper.h" 33 34 #include "CSSImportRule.h" 34 35 #include "CSSMediaRule.h" … … 5458 5459 } 5459 5460 return; 5461 case CSSPropertySize: 5462 applyPageSizeProperty(value); 5463 return; 5460 5464 case CSSPropertyInvalid: 5461 5465 return; … … 5463 5467 case CSSPropertyPage: 5464 5468 case CSSPropertyQuotes: 5465 case CSSPropertySize:5466 5469 case CSSPropertyTextLineThrough: 5467 5470 case CSSPropertyTextLineThroughColor: … … 5509 5512 #endif 5510 5513 } 5514 } 5515 5516 void 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 5585 bool 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 5661 Length CSSStyleSelector::mmLength(double mm) 5662 { 5663 return Length(CSSPrimitiveValue::create(mm, CSSPrimitiveValue::CSS_MM)->computeLengthIntForLength(style(), m_rootElementStyle), Fixed); 5664 } 5665 5666 Length CSSStyleSelector::inchLength(double inch) 5667 { 5668 return Length(CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN)->computeLengthIntForLength(style(), m_rootElementStyle), Fixed); 5511 5669 } 5512 5670 -
trunk/WebCore/css/CSSStyleSelector.h
r61232 r61670 261 261 262 262 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); 263 267 #if ENABLE(SVG) 264 268 void applySVGProperty(int id, CSSValue*); -
trunk/WebCore/css/html.css
r61376 r61670 728 728 @page { 729 729 /* FIXME: Define the right default values for page properties. */ 730 size: auto; 730 731 margin: 1in; 731 732 } -
trunk/WebCore/dom/Document.cpp
r61662 r61670 1503 1503 } 1504 1504 1505 bool 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 1511 IntRect 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 1527 IntSize 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 1505 1536 void Document::createStyleSelector() 1506 1537 { -
trunk/WebCore/dom/Document.h
r61232 r61670 484 484 PassRefPtr<RenderStyle> styleForElementIgnoringPendingStylesheets(Element*); 485 485 PassRefPtr<RenderStyle> styleForPage(int pageIndex); 486 bool isPageBoxVisible(int pageIndex); 487 IntRect pageAreaRectInPixels(int pageIndex); 488 IntSize preferredPageSizeInPixels(int pageIndex); 486 489 static void updateStyleForAllDocuments(); // FIXME: Try to reduce the # of calls to this function. 487 490 DocLoader* docLoader() { return m_docLoader.get(); } -
trunk/WebCore/page/PrintContext.cpp
r61232 r61670 219 219 } 220 220 221 bool PrintContext::isPageBoxVisible(Frame* frame, int pageNumber) 222 { 223 return frame->document()->isPageBoxVisible(pageNumber); 224 } 225 226 String 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 232 String 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 221 238 int PrintContext::numberOfPages(Frame* frame, const FloatSize& pageSizeInPixels) 222 239 { -
trunk/WebCore/page/PrintContext.h
r61232 r61670 57 57 static int pageNumberForElement(Element*, const FloatSize& pageSizeInPixels); 58 58 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); 59 62 static int numberOfPages(Frame*, const FloatSize& pageSizeInPixels); 60 63 -
trunk/WebCore/rendering/style/RenderStyle.h
r61548 r61670 704 704 Length perspectiveOriginX() const { return rareNonInheritedData->m_perspectiveOriginX; } 705 705 Length perspectiveOriginY() const { return rareNonInheritedData->m_perspectiveOriginY; } 706 LengthSize pageSize() const { return rareNonInheritedData->m_pageSize; } 706 707 707 708 #if USE(ACCELERATED_COMPOSITING) … … 1030 1031 void setPerspectiveOriginX(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginX, l); } 1031 1032 void setPerspectiveOriginY(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginY, l); } 1033 void setPageSize(LengthSize s) { SET_VAR(rareNonInheritedData, m_pageSize, s); } 1032 1034 1033 1035 #if USE(ACCELERATED_COMPOSITING) -
trunk/WebCore/rendering/style/StyleRareNonInheritedData.h
r61441 r61670 41 41 class AnimationList; 42 42 class CSSStyleSelector; 43 class LengthSize; 43 44 class ShadowData; 44 45 class StyleFlexibleBoxData; … … 124 125 Length m_perspectiveOriginY; 125 126 127 LengthSize m_pageSize; 128 126 129 #if ENABLE(XBL) 127 130 OwnPtr<BindingURI> bindingURI; // The XBL binding URI list. -
trunk/WebKit/mac/ChangeLog
r61633 r61670 1 2010-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 1 15 2010-06-22 Anders Carlsson <andersca@apple.com> 2 16 -
trunk/WebKit/mac/Misc/WebCoreStatistics.h
r61232 r61670 89 89 - (int)numberOfPages:(float)pageWidthInPixels:(float)pageHeightInPixels; 90 90 - (NSString *)pageProperty:(const char*)propertyName:(int)pageNumber; 91 - (bool)isPageBoxVisible:(int)pageNumber; 92 - (NSString *)pageAreaRectInPixels:(int)pageNumber; 93 - (NSString *)preferredPageSizeInPixels:(int)pageNumber; 91 94 @end -
trunk/WebKit/mac/Misc/WebCoreStatistics.mm
r61232 r61670 281 281 } 282 282 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 } 283 297 @end -
trunk/WebKitTools/ChangeLog
r61666 r61670 1 2010-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 1 29 2010-06-23 Sam Magnuson <smagnuson@netflix.com> 2 30 -
trunk/WebKitTools/DumpRenderTree/LayoutTestController.cpp
r61599 r61670 553 553 } 554 554 555 static 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 555 564 static JSValueRef pageNumberForElementByIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 556 565 { … … 592 601 delete[] propertyName; 593 602 return value; 603 } 604 605 static 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 615 static 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 625 static 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()); 594 633 } 595 634 … … 1652 1691 { "grantDesktopNotificationPermission", grantDesktopNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1653 1692 { "isCommandEnabled", isCommandEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1693 { "isPageBoxVisible", isPageBoxVisibleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1654 1694 { "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1655 1695 { "layerTreeAsText", layerTreeAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, … … 1660 1700 { "overridePreference", overridePreferenceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1661 1701 { "pageNumberForElementById", pageNumberForElementByIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1702 { "pageAreaRectInPixels", pageAreaRectInPixelsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1662 1703 { "pageProperty", pagePropertyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1663 1704 { "pathToLocalResource", pathToLocalResourceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1664 1705 { "pauseAnimationAtTimeOnElementWithId", pauseAnimationAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1665 1706 { "pauseTransitionAtTimeOnElementWithId", pauseTransitionAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1707 { "preferredPageSizeInPixels", preferredPageSizeInPixelsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1666 1708 { "sampleSVGAnimationForElementAtTime", sampleSVGAnimationForElementAtTimeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1667 1709 { "printToPDF", dumpAsPDFCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, -
trunk/WebKitTools/DumpRenderTree/LayoutTestController.h
r61599 r61670 65 65 int pageNumberForElementById(JSStringRef id, float pageWidthInPixels, float pageHeightInPixels); 66 66 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; 67 70 JSStringRef pathToLocalResource(JSContextRef, JSStringRef url); 68 71 void queueBackNavigation(int howFarBackward); -
trunk/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
r61232 r61670 178 178 } 179 179 180 bool LayoutTestController::isPageBoxVisible(int pageNumber) const 181 { 182 // FIXME: implement 183 return false; 184 } 185 186 JSRetainPtr<JSStringRef> LayoutTestController::pageAreaRectInPixels(int pageNumber) const 187 { 188 // FIXME: implement 189 return JSRetainPtr<JSStringRef>(); 190 } 191 192 JSRetainPtr<JSStringRef> LayoutTestController::preferredPageSizeInPixels(int pageNumber) const 193 { 194 // FIXME: implement 195 return JSRetainPtr<JSStringRef>(); 196 } 197 180 198 size_t LayoutTestController::webHistoryItemCount() 181 199 { -
trunk/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
r61599 r61670 219 219 } 220 220 221 bool LayoutTestController::isPageBoxVisible(int pageNumber) const 222 { 223 return [mainFrame isPageBoxVisible:pageNumber]; 224 } 225 226 JSRetainPtr<JSStringRef> LayoutTestController::pageAreaRectInPixels(int pageNumber) const 227 { 228 JSRetainPtr<JSStringRef> propertyValue(Adopt, JSStringCreateWithCFString((CFStringRef)[mainFrame pageAreaRectInPixels:pageNumber])); 229 return propertyValue; 230 } 231 232 JSRetainPtr<JSStringRef> LayoutTestController::preferredPageSizeInPixels(int pageNumber) const 233 { 234 JSRetainPtr<JSStringRef> propertyValue(Adopt, JSStringCreateWithCFString((CFStringRef)[mainFrame preferredPageSizeInPixels:pageNumber])); 235 return propertyValue; 236 } 237 221 238 int LayoutTestController::numberOfPages(float pageWidthInPixels, float pageHeightInPixels) 222 239 { -
trunk/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
r61232 r61670 1249 1249 } 1250 1250 1251 bool LayoutTestController::isPageBoxVisible(int pageNumber) const 1252 { 1253 // FIXME: implement 1254 return false; 1255 } 1256 1257 JSRetainPtr<JSStringRef> LayoutTestController::pageAreaRectInPixels(int pageNumber) const 1258 { 1259 // FIXME: implement 1260 return JSRetainPtr<JSStringRef>(); 1261 } 1262 1263 JSRetainPtr<JSStringRef> LayoutTestController::preferredPageSizeInPixels(int pageNumber) const 1264 { 1265 // FIXME: implement 1266 return JSRetainPtr<JSStringRef>(); 1267 } 1268 1251 1269 void LayoutTestController::apiTestGoToCurrentBackForwardItem() 1252 1270 {
Note: See TracChangeset
for help on using the changeset viewer.