| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1729 } | 1729 } |
| 1730 | 1730 |
| 1731 String Internals::counterValue(Element* element) | 1731 String Internals::counterValue(Element* element) |
| 1732 { | 1732 { |
| 1733 if (!element) | 1733 if (!element) |
| 1734 return String(); | 1734 return String(); |
| 1735 | 1735 |
| 1736 return counterValueForElement(element); | 1736 return counterValueForElement(element); |
| 1737 } | 1737 } |
| 1738 | 1738 |
| 1739 int Internals::pageNumber(Element* element, float pageWidth, float pageHeight) | 1739 int Internals::pageNumber(Element* element, float pageWidth, float pageHeight, E
xceptionState& exceptionState) |
| 1740 { | 1740 { |
| 1741 if (!element) | 1741 if (!element) |
| 1742 return 0; | 1742 return 0; |
| 1743 | 1743 |
| 1744 if (pageWidth <= 0 || pageHeight <= 0) { |
| 1745 exceptionState.throwDOMException(V8TypeError, "Page width and height mus
t be larger than 0."); |
| 1746 return 0; |
| 1747 } |
| 1748 |
| 1744 return PrintContext::pageNumberForElement(element, FloatSize(pageWidth, page
Height)); | 1749 return PrintContext::pageNumberForElement(element, FloatSize(pageWidth, page
Height)); |
| 1745 } | 1750 } |
| 1746 | 1751 |
| 1747 Vector<String> Internals::iconURLs(Document* document, int iconTypesMask) const | 1752 Vector<String> Internals::iconURLs(Document* document, int iconTypesMask) const |
| 1748 { | 1753 { |
| 1749 Vector<IconURL> iconURLs = document->iconURLs(iconTypesMask); | 1754 Vector<IconURL> iconURLs = document->iconURLs(iconTypesMask); |
| 1750 Vector<String> array; | 1755 Vector<String> array; |
| 1751 | 1756 |
| 1752 for (auto& iconURL : iconURLs) | 1757 for (auto& iconURL : iconURLs) |
| 1753 array.append(iconURL.m_iconURL.string()); | 1758 array.append(iconURL.m_iconURL.string()); |
| 1754 | 1759 |
| 1755 return array; | 1760 return array; |
| 1756 } | 1761 } |
| 1757 | 1762 |
| 1758 Vector<String> Internals::shortcutIconURLs(Document* document) const | 1763 Vector<String> Internals::shortcutIconURLs(Document* document) const |
| 1759 { | 1764 { |
| 1760 return iconURLs(document, Favicon); | 1765 return iconURLs(document, Favicon); |
| 1761 } | 1766 } |
| 1762 | 1767 |
| 1763 Vector<String> Internals::allIconURLs(Document* document) const | 1768 Vector<String> Internals::allIconURLs(Document* document) const |
| 1764 { | 1769 { |
| 1765 return iconURLs(document, Favicon | TouchIcon | TouchPrecomposedIcon); | 1770 return iconURLs(document, Favicon | TouchIcon | TouchPrecomposedIcon); |
| 1766 } | 1771 } |
| 1767 | 1772 |
| 1768 int Internals::numberOfPages(float pageWidth, float pageHeight) | 1773 int Internals::numberOfPages(float pageWidth, float pageHeight, ExceptionState&
exceptionState) |
| 1769 { | 1774 { |
| 1770 if (!frame()) | 1775 if (!frame()) |
| 1771 return -1; | 1776 return -1; |
| 1772 | 1777 |
| 1778 if (pageWidth <= 0 || pageHeight <= 0) { |
| 1779 exceptionState.throwDOMException(V8TypeError, "Page width and height mus
t be larger than 0."); |
| 1780 return -1; |
| 1781 } |
| 1782 |
| 1773 return PrintContext::numberOfPages(frame(), FloatSize(pageWidth, pageHeight)
); | 1783 return PrintContext::numberOfPages(frame(), FloatSize(pageWidth, pageHeight)
); |
| 1774 } | 1784 } |
| 1775 | 1785 |
| 1776 String Internals::pageProperty(String propertyName, int pageNumber, ExceptionSta
te& exceptionState) const | 1786 String Internals::pageProperty(String propertyName, int pageNumber, ExceptionSta
te& exceptionState) const |
| 1777 { | 1787 { |
| 1778 if (!frame()) { | 1788 if (!frame()) { |
| 1779 exceptionState.throwDOMException(InvalidAccessError, "No frame is availa
ble."); | 1789 exceptionState.throwDOMException(InvalidAccessError, "No frame is availa
ble."); |
| 1780 return String(); | 1790 return String(); |
| 1781 } | 1791 } |
| 1782 | 1792 |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2547 mediaElement->setNetworkState(static_cast<WebMediaPlayer::NetworkState>(stat
e)); | 2557 mediaElement->setNetworkState(static_cast<WebMediaPlayer::NetworkState>(stat
e)); |
| 2548 } | 2558 } |
| 2549 | 2559 |
| 2550 // TODO(liberato): remove once autoplay gesture override experiment concludes. | 2560 // TODO(liberato): remove once autoplay gesture override experiment concludes. |
| 2551 void Internals::triggerAutoplayViewportCheck(HTMLMediaElement* element) | 2561 void Internals::triggerAutoplayViewportCheck(HTMLMediaElement* element) |
| 2552 { | 2562 { |
| 2553 element->triggerAutoplayViewportCheckForTesting(); | 2563 element->triggerAutoplayViewportCheckForTesting(); |
| 2554 } | 2564 } |
| 2555 | 2565 |
| 2556 } // namespace blink | 2566 } // namespace blink |
| OLD | NEW |