Changeset 122326 in webkit
- Timestamp:
- Jul 11, 2012 4:26:50 AM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r122320 r122326 1 2012-07-11 MORITA Hajime <morrita@google.com> 2 3 WebCoreSupport needs objects each of which follows major WebCore objects 4 https://bugs.webkit.org/show_bug.cgi?id=88499 5 6 Reviewed by Alexey Proskuryakov. 7 8 This change 9 10 - Makes Internals rough lifetime to follow Document. 11 Note that Internals can survive longer than Document in same case. 12 Internals::m_document is cleared when the document destruction is notified. 13 - Makes InternalSettings rough lifetime to follow the Page. 14 This is done by making InternalSettings a supplement of the page. 15 Now InternalSettings object is created per Page instead of per Frame. 16 17 Per-test setting clearance is done by newly introduced InternalSettings::Backup, 18 which recovers the modified settings and refreshes it for each time a test starts. 19 20 * WebCore.exp.in: 21 * testing/InternalSettings.cpp: 22 (WebCore::InternalSettings::Backup::Backup): 23 (WebCore): 24 (WebCore::InternalSettings::Backup::restoreTo): 25 (WebCore::InternalSettings::from): 26 (WebCore::InternalSettings::~InternalSettings): 27 (WebCore::InternalSettings::InternalSettings): 28 (WebCore::InternalSettings::reset): 29 (WebCore::InternalSettings::settings): 30 (WebCore::InternalSettings::setFixedElementsLayoutRelativeToFrame): 31 (WebCore::InternalSettings::setFixedPositionCreatesStackingContext): 32 (WebCore::InternalSettings::allowRoundingHacks): 33 (WebCore::InternalSettings::userPreferredLanguages): 34 (WebCore::InternalSettings::setUserPreferredLanguages): 35 (WebCore::InternalSettings::setShouldDisplayTrackKind): 36 (WebCore::InternalSettings::shouldDisplayTrackKind): 37 (WebCore::InternalSettings::setPagination): 38 * testing/InternalSettings.h: 39 (Backup): 40 (InternalSettings): 41 (WebCore::InternalSettings::page): 42 * testing/InternalSettings.idl: 43 * testing/Internals.cpp: 44 (WebCore::Internals::Internals): 45 (WebCore): 46 (WebCore::Internals::contextDocument): 47 (WebCore::Internals::frame): 48 (WebCore::Internals::settings): 49 (WebCore::Internals::setPagination): Replaced as an alias. 50 (WebCore::Internals::userPreferredLanguages): Replaced as an alias. 51 (WebCore::Internals::setUserPreferredLanguages): Replaced as an alias. 52 (WebCore::Internals::setShouldDisplayTrackKind): Replaced as an alias. 53 (WebCore::Internals::shouldDisplayTrackKind): Replaced as an alias. 54 (WebCore::Internals::emitInspectorDidBeginFrame): 55 (WebCore::Internals::emitInspectorDidCancelFrame): 56 (WebCore::Internals::allowRoundingHacks): Replaced as an alias. 57 * testing/Internals.h: 58 (WebCore): 59 (Internals): 60 * testing/js/WebCoreTestSupport.cpp: 61 (WebCoreTestSupport::injectInternalsObject): 62 (WebCoreTestSupport::resetInternalsObject): 63 * testing/v8/WebCoreTestSupport.cpp: 64 (WebCoreTestSupport::injectInternalsObject): 65 (WebCoreTestSupport::resetInternalsObject): 66 1 67 2012-07-11 Yoshifumi Inoue <yosin@chromium.org> 2 68 -
trunk/Source/WebCore/WebCore.exp.in
r122205 r122326 612 612 __ZN7WebCore26UserTypingGestureIndicator28focusedElementAtGestureStartEv 613 613 __ZN7WebCore26stopObservingCookieChangesEv 614 __ZN7WebCore26ContextDestructionObserverD2Ev 615 __ZN7WebCore26ContextDestructionObserverC2EPNS_22ScriptExecutionContextE 616 __ZN7WebCore26ContextDestructionObserver16contextDestroyedEv 614 617 __ZN7WebCore27AuthenticationChallengeBaseC2Ev 615 618 __ZN7WebCore27CSSComputedStyleDeclarationC1EN3WTF10PassRefPtrINS_4NodeEEEbRKNS1_6StringE -
trunk/Source/WebCore/testing/InternalSettings.cpp
r121907 r122326 38 38 #include "RuntimeEnabledFeatures.h" 39 39 #include "Settings.h" 40 #include "TextRun.h" 40 41 41 42 #if ENABLE(INPUT_TYPE_COLOR) … … 55 56 } 56 57 57 #define InternalSettingsGuardForFrame() \58 if (!frame()) { \59 ec = INVALID_ACCESS_ERR; \60 return; \61 }62 63 #define InternalSettingsGuardForFrameView() \64 if (!frame() || !frame()->view()) { \65 ec = INVALID_ACCESS_ERR; \66 return; \67 }68 69 58 #define InternalSettingsGuardForPageReturn(returnValue) \ 70 59 if (!page()) { \ … … 81 70 namespace WebCore { 82 71 83 84 PassRefPtr<InternalSettings> InternalSettings::create(Frame* frame) 85 { 86 return adoptRef(new InternalSettings(frame)); 87 } 88 89 InternalSettings::~InternalSettings() 90 { 91 } 92 93 InternalSettings::InternalSettings(Frame* frame) 94 : FrameDestructionObserver(frame) 95 , m_originalPasswordEchoDurationInSeconds(settings()->passwordEchoDurationInSeconds()) 96 , m_originalPasswordEchoEnabled(settings()->passwordEchoEnabled()) 72 InternalSettings::Backup::Backup(Page* page, Settings* settings) 73 : m_originalPasswordEchoDurationInSeconds(settings->passwordEchoDurationInSeconds()) 74 , m_originalPasswordEchoEnabled(settings->passwordEchoEnabled()) 97 75 , m_originalCSSExclusionsEnabled(RuntimeEnabledFeatures::cssExclusionsEnabled()) 98 76 #if ENABLE(SHADOW_DOM) 99 77 , m_originalShadowDOMEnabled(RuntimeEnabledFeatures::shadowDOMEnabled()) 100 78 #endif 101 , m_originalEditingBehavior(settings ()->editingBehaviorType())102 , m_originalFixedPositionCreatesStackingContext(settings ()->fixedPositionCreatesStackingContext())103 , m_originalSyncXHRInDocumentsEnabled(settings ()->syncXHRInDocumentsEnabled())79 , m_originalEditingBehavior(settings->editingBehaviorType()) 80 , m_originalFixedPositionCreatesStackingContext(settings->fixedPositionCreatesStackingContext()) 81 , m_originalSyncXHRInDocumentsEnabled(settings->syncXHRInDocumentsEnabled()) 104 82 #if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER) 105 , m_originalJavaScriptProfilingEnabled(page () && page()->inspectorController() && page()->inspectorController()->profilerEnabled())106 #endif 107 , m_originalWindowFocusRestricted(settings ()->windowFocusRestricted())108 , m_originalDeviceSupportsTouch(settings ()->deviceSupportsTouch())109 , m_originalDeviceSupportsMouse(settings ()->deviceSupportsMouse())83 , m_originalJavaScriptProfilingEnabled(page->inspectorController() && page->inspectorController()->profilerEnabled()) 84 #endif 85 , m_originalWindowFocusRestricted(settings->windowFocusRestricted()) 86 , m_originalDeviceSupportsTouch(settings->deviceSupportsTouch()) 87 , m_originalDeviceSupportsMouse(settings->deviceSupportsMouse()) 110 88 #if ENABLE(TEXT_AUTOSIZING) 111 , m_originalTextAutosizingEnabled(settings()->textAutosizingEnabled()) 112 , m_originalTextAutosizingWindowSizeOverride(settings()->textAutosizingWindowSizeOverride()) 113 #endif 114 { 115 } 116 117 void InternalSettings::restoreTo(Settings* settings) 89 , m_originalTextAutosizingEnabled(settings->textAutosizingEnabled()) 90 , m_originalTextAutosizingWindowSizeOverride(settings->textAutosizingWindowSizeOverride()) 91 #endif 92 { 93 } 94 95 96 void InternalSettings::Backup::restoreTo(Page* page, Settings* settings) 118 97 { 119 98 settings->setPasswordEchoDurationInSeconds(m_originalPasswordEchoDurationInSeconds); … … 127 106 settings->setSyncXHRInDocumentsEnabled(m_originalSyncXHRInDocumentsEnabled); 128 107 #if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER) 129 if (page () && page()->inspectorController())130 page ()->inspectorController()->setProfilerEnabled(m_originalJavaScriptProfilingEnabled);108 if (page->inspectorController()) 109 page->inspectorController()->setProfilerEnabled(m_originalJavaScriptProfilingEnabled); 131 110 #endif 132 111 settings->setWindowFocusRestricted(m_originalWindowFocusRestricted); … … 139 118 } 140 119 120 InternalSettings* InternalSettings::from(Page* page) 121 { 122 DEFINE_STATIC_LOCAL(AtomicString, name, ("InternalSettings")); 123 if (!SuperType::from(page, name)) 124 SuperType::provideTo(page, name, adoptRef(new InternalSettings(page))); 125 return static_cast<InternalSettings*>(SuperType::from(page, name)); 126 } 127 128 InternalSettings::~InternalSettings() 129 { 130 } 131 132 InternalSettings::InternalSettings(Page* page) 133 : m_page(page) 134 , m_backup(page, page->settings()) 135 { 136 } 137 138 void InternalSettings::reset() 139 { 140 TextRun::setAllowsRoundingHacks(false); 141 setUserPreferredLanguages(Vector<String>()); 142 page()->setPagination(Page::Pagination()); 143 page()->setPageScaleFactor(1, IntPoint(0, 0)); 144 145 m_backup.restoreTo(page(), settings()); 146 m_backup = Backup(page(), settings()); 147 } 148 141 149 Settings* InternalSettings::settings() const 142 150 { 143 if (! frame() || !frame()->page())151 if (!page()) 144 152 return 0; 145 return frame()->page()->settings(); 146 } 147 148 Document* InternalSettings::document() const 149 { 150 return frame() ? frame()->document() : 0; 151 } 152 153 Page* InternalSettings::page() const 154 { 155 return document() ? document()->page() : 0; 153 return page()->settings(); 156 154 } 157 155 … … 221 219 void InternalSettings::setFixedElementsLayoutRelativeToFrame(bool enabled, ExceptionCode& ec) 222 220 { 223 InternalSettingsGuardFor FrameView();221 InternalSettingsGuardForSettings(); 224 222 settings()->setFixedElementsLayoutRelativeToFrame(enabled); 225 223 } … … 413 411 void InternalSettings::setFixedPositionCreatesStackingContext(bool creates, ExceptionCode& ec) 414 412 { 415 InternalSettingsGuardFor FrameView();413 InternalSettingsGuardForSettings(); 416 414 settings()->setFixedPositionCreatesStackingContext(creates); 417 415 } … … 445 443 } 446 444 447 } 445 void InternalSettings::allowRoundingHacks() const 446 { 447 TextRun::setAllowsRoundingHacks(true); 448 } 449 450 Vector<String> InternalSettings::userPreferredLanguages() const 451 { 452 return WebCore::userPreferredLanguages(); 453 } 454 455 void InternalSettings::setUserPreferredLanguages(const Vector<String>& languages) 456 { 457 WebCore::overrideUserPreferredLanguages(languages); 458 } 459 460 void InternalSettings::setShouldDisplayTrackKind(const String& kind, bool enabled, ExceptionCode& ec) 461 { 462 InternalSettingsGuardForSettings(); 463 464 #if ENABLE(VIDEO_TRACK) 465 if (equalIgnoringCase(kind, "Subtitles")) 466 settings()->setShouldDisplaySubtitles(enabled); 467 else if (equalIgnoringCase(kind, "Captions")) 468 settings()->setShouldDisplayCaptions(enabled); 469 else if (equalIgnoringCase(kind, "TextDescriptions")) 470 settings()->setShouldDisplayTextDescriptions(enabled); 471 else 472 ec = SYNTAX_ERR; 473 #else 474 UNUSED_PARAM(kind); 475 UNUSED_PARAM(enabled); 476 #endif 477 } 478 479 bool InternalSettings::shouldDisplayTrackKind(const String& kind, ExceptionCode& ec) 480 { 481 InternalSettingsGuardForSettingsReturn(false); 482 483 #if ENABLE(VIDEO_TRACK) 484 if (equalIgnoringCase(kind, "Subtitles")) 485 return settings()->shouldDisplaySubtitles(); 486 if (equalIgnoringCase(kind, "Captions")) 487 return settings()->shouldDisplayCaptions(); 488 if (equalIgnoringCase(kind, "TextDescriptions")) 489 return settings()->shouldDisplayTextDescriptions(); 490 491 ec = SYNTAX_ERR; 492 return false; 493 #else 494 UNUSED_PARAM(kind); 495 return false; 496 #endif 497 } 498 499 void InternalSettings::setPagination(const String& mode, int gap, ExceptionCode& ec) 500 { 501 if (!page()) { 502 ec = INVALID_ACCESS_ERR; 503 return; 504 } 505 506 Page::Pagination pagination; 507 if (mode == "Unpaginated") 508 pagination.mode = Page::Pagination::Unpaginated; 509 else if (mode == "LeftToRightPaginated") 510 pagination.mode = Page::Pagination::LeftToRightPaginated; 511 else if (mode == "RightToLeftPaginated") 512 pagination.mode = Page::Pagination::RightToLeftPaginated; 513 else if (mode == "TopToBottomPaginated") 514 pagination.mode = Page::Pagination::TopToBottomPaginated; 515 else if (mode == "BottomToTopPaginated") 516 pagination.mode = Page::Pagination::BottomToTopPaginated; 517 else { 518 ec = SYNTAX_ERR; 519 return; 520 } 521 522 pagination.gap = gap; 523 page()->setPagination(pagination); 524 } 525 526 String InternalSettings::configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode& ec) 527 { 528 if (!page()) { 529 ec = INVALID_ACCESS_ERR; 530 return String(); 531 } 532 533 const int defaultLayoutWidthForNonMobilePages = 980; 534 535 ViewportArguments arguments = page()->viewportArguments(); 536 ViewportAttributes attributes = computeViewportAttributes(arguments, defaultLayoutWidthForNonMobilePages, deviceWidth, deviceHeight, devicePixelRatio, IntSize(availableWidth, availableHeight)); 537 restrictMinimumScaleFactorToViewportSize(attributes, IntSize(availableWidth, availableHeight)); 538 restrictScaleFactorToInitialScaleIfNotUserScalable(attributes); 539 540 return "viewport size " + String::number(attributes.layoutSize.width()) + "x" + String::number(attributes.layoutSize.height()) + " scale " + String::number(attributes.initialScale) + " with limits [" + String::number(attributes.minimumScale) + ", " + String::number(attributes.maximumScale) + "] and userScalable " + (attributes.userScalable ? "true" : "false"); 541 } 542 543 544 } -
trunk/Source/WebCore/testing/InternalSettings.h
r121907 r122326 28 28 29 29 #include "EditingBehaviorTypes.h" 30 #include " FrameDestructionObserver.h"30 #include "RefCountedSupplement.h" 31 31 #include <wtf/PassRefPtr.h> 32 32 #include <wtf/RefCounted.h> … … 46 46 class Settings; 47 47 48 class InternalSettings : public RefCounted<InternalSettings>, 49 public FrameDestructionObserver { 48 class InternalSettings : public RefCountedSupplement<Page, InternalSettings> { 50 49 public: 51 static PassRefPtr<InternalSettings> create(Frame*); 50 class Backup { 51 public: 52 Backup(Page*, Settings*); 53 void restoreTo(Page*, Settings*); 54 55 double m_originalPasswordEchoDurationInSeconds; 56 bool m_originalPasswordEchoEnabled; 57 bool m_originalCSSExclusionsEnabled; 58 #if ENABLE(SHADOW_DOM) 59 bool m_originalShadowDOMEnabled; 60 #endif 61 EditingBehaviorType m_originalEditingBehavior; 62 bool m_originalFixedPositionCreatesStackingContext; 63 bool m_originalSyncXHRInDocumentsEnabled; 64 #if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER) 65 bool m_originalJavaScriptProfilingEnabled; 66 #endif 67 bool m_originalWindowFocusRestricted; 68 bool m_originalDeviceSupportsTouch; 69 bool m_originalDeviceSupportsMouse; 70 #if ENABLE(TEXT_AUTOSIZING) 71 bool m_originalTextAutosizingEnabled; 72 IntSize m_originalTextAutosizingWindowSizeOverride; 73 #endif 74 }; 75 76 typedef RefCountedSupplement<Page, InternalSettings> SuperType; 77 static InternalSettings* from(Page*); 52 78 53 79 virtual ~InternalSettings(); 80 81 void reset(); 54 82 55 83 void setInspectorResourcesDataSizeLimits(int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionCode&); … … 89 117 void setSyncXHRInDocumentsEnabled(bool, ExceptionCode&); 90 118 void setWindowFocusRestricted(bool, ExceptionCode&); 91 92 void restoreTo(Settings*);93 94 119 void setJavaScriptProfilingEnabled(bool enabled, ExceptionCode&); 95 120 Vector<String> userPreferredLanguages() const; 121 void setUserPreferredLanguages(const Vector<String>&); 122 void setPagination(const String& mode, int gap, ExceptionCode&); 123 void allowRoundingHacks() const; 124 void setShouldDisplayTrackKind(const String& kind, bool enabled, ExceptionCode&); 125 bool shouldDisplayTrackKind(const String& kind, ExceptionCode&); 126 String configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode&); 96 127 private: 97 InternalSettings(Frame*); 128 explicit InternalSettings(Page*); 129 virtual void hostDestroyed() OVERRIDE { m_page = 0; } 98 130 99 131 Settings* settings() const; 100 Document* document() const; 101 Page* page() const; 132 Page* page() const { return m_page; } 102 133 103 double m_originalPasswordEchoDurationInSeconds; 104 bool m_originalPasswordEchoEnabled; 105 bool m_originalCSSExclusionsEnabled; 106 #if ENABLE(SHADOW_DOM) 107 bool m_originalShadowDOMEnabled; 108 #endif 109 EditingBehaviorType m_originalEditingBehavior; 110 bool m_originalFixedPositionCreatesStackingContext; 111 bool m_originalSyncXHRInDocumentsEnabled; 112 #if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER) 113 bool m_originalJavaScriptProfilingEnabled; 114 #endif 115 bool m_originalWindowFocusRestricted; 116 bool m_originalDeviceSupportsTouch; 117 bool m_originalDeviceSupportsMouse; 118 #if ENABLE(TEXT_AUTOSIZING) 119 bool m_originalTextAutosizingEnabled; 120 IntSize m_originalTextAutosizingWindowSizeOverride; 121 #endif 134 Page* m_page; 135 Backup m_backup; 122 136 }; 123 137 -
trunk/Source/WebCore/testing/InternalSettings.idl
r121907 r122326 65 65 void setJavaScriptProfilingEnabled(in boolean creates) raises(DOMException); 66 66 void setWindowFocusRestricted(in boolean restricted) raises(DOMException); 67 68 void setPagination(in DOMString mode, in long gap) raises(DOMException); 69 sequence<String> userPreferredLanguages(); 70 void setUserPreferredLanguages(in sequence<String> languages); 71 void allowRoundingHacks(); 72 #if defined(ENABLE_VIDEO_TRACK) && ENABLE_VIDEO_TRACK 73 void setShouldDisplayTrackKind(in DOMString kind, in boolean enabled) raises (DOMException); 74 boolean shouldDisplayTrackKind(in DOMString trackKind) raises (DOMException); 75 #endif 67 76 }; 68 77 } -
trunk/Source/WebCore/testing/Internals.cpp
r122205 r122326 64 64 #include "SpellChecker.h" 65 65 #include "TextIterator.h" 66 #include "TextRun.h"67 66 #include "TreeScope.h" 68 67 #include "ViewportArguments.h" … … 148 147 149 148 Internals::Internals(Document* document) 150 : FrameDestructionObserver(0) 151 { 152 reset(document); 149 : ContextDestructionObserver(document) 150 { 151 } 152 153 Document* Internals::contextDocument() const 154 { 155 return static_cast<Document*>(scriptExecutionContext()); 156 } 157 158 Frame* Internals::frame() const 159 { 160 if (!contextDocument()) 161 return 0; 162 return contextDocument()->frame(); 163 } 164 165 InternalSettings* Internals::settings() const 166 { 167 Document* document = contextDocument(); 168 if (!document) 169 return 0; 170 Page* page = document->page(); 171 if (!page) 172 return 0; 173 return InternalSettings::from(page); 153 174 } 154 175 … … 608 629 } 609 630 610 void Internals::setPagination(Document* document, const String& mode, int gap, ExceptionCode& ec) 611 { 612 if (!document || !document->page()) { 613 ec = INVALID_ACCESS_ERR; 614 return; 615 } 616 617 Page::Pagination pagination; 618 if (mode == "Unpaginated") 619 pagination.mode = Page::Pagination::Unpaginated; 620 else if (mode == "LeftToRightPaginated") 621 pagination.mode = Page::Pagination::LeftToRightPaginated; 622 else if (mode == "RightToLeftPaginated") 623 pagination.mode = Page::Pagination::RightToLeftPaginated; 624 else if (mode == "TopToBottomPaginated") 625 pagination.mode = Page::Pagination::TopToBottomPaginated; 626 else if (mode == "BottomToTopPaginated") 627 pagination.mode = Page::Pagination::BottomToTopPaginated; 628 else { 629 ec = SYNTAX_ERR; 630 return; 631 } 632 633 pagination.gap = gap; 634 635 document->page()->setPagination(pagination); 636 } 637 638 String Internals::configurationForViewport(Document* document, float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode& ec) 639 { 640 if (!document || !document->page()) { 641 ec = INVALID_ACCESS_ERR; 642 return String(); 643 } 644 645 const int defaultLayoutWidthForNonMobilePages = 980; 646 647 ViewportArguments arguments = document->page()->viewportArguments(); 648 ViewportAttributes attributes = computeViewportAttributes(arguments, defaultLayoutWidthForNonMobilePages, deviceWidth, deviceHeight, devicePixelRatio, IntSize(availableWidth, availableHeight)); 649 restrictMinimumScaleFactorToViewportSize(attributes, IntSize(availableWidth, availableHeight)); 650 restrictScaleFactorToInitialScaleIfNotUserScalable(attributes); 651 652 return "viewport size " + String::number(attributes.layoutSize.width()) + "x" + String::number(attributes.layoutSize.height()) + " scale " + String::number(attributes.initialScale) + " with limits [" + String::number(attributes.minimumScale) + ", " + String::number(attributes.maximumScale) + "] and userScalable " + (attributes.userScalable ? "true" : "false"); 653 } 654 655 void Internals::reset(Document* document) 656 { 657 if (!document || !document->settings()) 658 return; 659 660 observeFrame(document->frame()); 661 662 if (m_settings) 663 m_settings->restoreTo(document->page()->settings()); 664 m_settings = InternalSettings::create(document->frame()); 665 if (Page* page = document->page()) { 666 page->setPagination(Page::Pagination()); 667 668 if (document->frame() == page->mainFrame()) 669 setUserPreferredLanguages(Vector<String>()); 670 671 page->setPageScaleFactor(1, IntPoint(0, 0)); 672 } 673 674 resetDefaultsToConsistentValues(); 675 } 676 677 void Internals::resetDefaultsToConsistentValues() 678 { 679 TextRun::setAllowsRoundingHacks(false); 631 void Internals::setPagination(Document*, const String& mode, int gap, ExceptionCode& ec) 632 { 633 settings()->setPagination(mode, gap, ec); 634 } 635 636 String Internals::configurationForViewport(Document*, float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode& ec) 637 { 638 return settings()->configurationForViewport(devicePixelRatio, deviceWidth, deviceHeight, availableWidth, availableHeight, ec); 680 639 } 681 640 … … 908 867 Vector<String> Internals::userPreferredLanguages() const 909 868 { 910 return WebCore::userPreferredLanguages();869 return settings()->userPreferredLanguages(); 911 870 } 912 871 913 872 void Internals::setUserPreferredLanguages(const Vector<String>& languages) 914 873 { 915 WebCore::overrideUserPreferredLanguages(languages); 916 } 917 918 void Internals::setShouldDisplayTrackKind(Document* document, const String& kind, bool enabled, ExceptionCode& ec) 919 { 920 if (!document || !document->frame() || !document->frame()->settings()) { 921 ec = INVALID_ACCESS_ERR; 922 return; 923 } 924 925 #if ENABLE(VIDEO_TRACK) 926 Settings* settings = document->frame()->settings(); 927 928 if (equalIgnoringCase(kind, "Subtitles")) 929 settings->setShouldDisplaySubtitles(enabled); 930 else if (equalIgnoringCase(kind, "Captions")) 931 settings->setShouldDisplayCaptions(enabled); 932 else if (equalIgnoringCase(kind, "TextDescriptions")) 933 settings->setShouldDisplayTextDescriptions(enabled); 934 else 935 ec = SYNTAX_ERR; 936 #else 937 UNUSED_PARAM(kind); 938 UNUSED_PARAM(enabled); 939 #endif 940 } 941 942 bool Internals::shouldDisplayTrackKind(Document* document, const String& kind, ExceptionCode& ec) 943 { 944 if (!document || !document->frame() || !document->frame()->settings()) { 945 ec = INVALID_ACCESS_ERR; 946 return false; 947 } 948 949 #if ENABLE(VIDEO_TRACK) 950 Settings* settings = document->frame()->settings(); 951 952 if (equalIgnoringCase(kind, "Subtitles")) 953 return settings->shouldDisplaySubtitles(); 954 if (equalIgnoringCase(kind, "Captions")) 955 return settings->shouldDisplayCaptions(); 956 if (equalIgnoringCase(kind, "TextDescriptions")) 957 return settings->shouldDisplayTextDescriptions(); 958 959 ec = SYNTAX_ERR; 960 return false; 961 #else 962 UNUSED_PARAM(kind); 963 return false; 964 #endif 874 settings()->setUserPreferredLanguages(languages); 875 } 876 877 void Internals::setShouldDisplayTrackKind(Document*, const String& kind, bool enabled, ExceptionCode& ec) 878 { 879 settings()->setShouldDisplayTrackKind(kind, enabled, ec); 880 } 881 882 bool Internals::shouldDisplayTrackKind(Document*, const String& kind, ExceptionCode& ec) 883 { 884 return settings()->shouldDisplayTrackKind(kind, ec); 965 885 } 966 886 … … 998 918 void Internals::emitInspectorDidBeginFrame() 999 919 { 1000 InspectorInstrumentation::didBeginFrame( frame()->page());920 InspectorInstrumentation::didBeginFrame(contextDocument()->frame()->page()); 1001 921 } 1002 922 1003 923 void Internals::emitInspectorDidCancelFrame() 1004 924 { 1005 InspectorInstrumentation::didCancelFrame( frame()->page());925 InspectorInstrumentation::didCancelFrame(contextDocument()->frame()->page()); 1006 926 } 1007 927 … … 1146 1066 void Internals::allowRoundingHacks() const 1147 1067 { 1148 TextRun::setAllowsRoundingHacks(true);1068 settings()->allowRoundingHacks(); 1149 1069 } 1150 1070 -
trunk/Source/WebCore/testing/Internals.h
r122205 r122326 27 27 #define Internals_h 28 28 29 #include " FrameDestructionObserver.h"29 #include "ContextDestructionObserver.h" 30 30 #include "NodeList.h" 31 31 #include "PlatformString.h" … … 42 42 class DocumentMarker; 43 43 class Element; 44 class Frame; 44 45 class InternalSettings; 45 46 class Node; 46 47 class Range; 48 class ScriptExecutionContext; 47 49 class ShadowRoot; 48 50 class WebKitPoint; … … 50 52 typedef int ExceptionCode; 51 53 52 class Internals : public RefCounted<Internals> ,53 public FrameDestructionObserver {54 class Internals : public RefCounted<Internals> 55 , public ContextDestructionObserver { 54 56 public: 55 57 static PassRefPtr<Internals> create(Document*); 56 58 virtual ~Internals(); 57 58 void reset(Document*);59 59 60 60 String elementRenderTreeAsText(Element*, ExceptionCode&); … … 116 116 117 117 void setScrollViewPosition(Document*, long x, long y, ExceptionCode&); 118 119 118 void setPagination(Document*, const String& mode, int gap, ExceptionCode&); 120 119 String configurationForViewport(Document*, float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode&); … … 168 167 static const char* internalsId; 169 168 170 InternalSettings* settings() const { return m_settings.get(); }169 InternalSettings* settings() const; 171 170 172 171 void setBatteryStatus(Document*, const String& eventType, bool charging, double chargingTime, double dischargingTime, double level, ExceptionCode&); … … 199 198 private: 200 199 explicit Internals(Document*); 200 Document* contextDocument() const; 201 Frame* frame() const; 202 201 203 DocumentMarker* markerAt(Node*, const String& markerType, unsigned index, ExceptionCode&); 202 void resetDefaultsToConsistentValues();203 204 RefPtr<InternalSettings> m_settings;205 204 }; 206 205 -
trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp
r121912 r122326 27 27 #include "WebCoreTestSupport.h" 28 28 29 #include "Frame.h" 30 #include "InternalSettings.h" 29 31 #include "Internals.h" 30 32 #include "JSDocument.h" … … 44 46 JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()); 45 47 ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext(); 46 Document* document = scriptContext->isDocument() ? static_cast<Document*>(scriptContext) : 0;47 globalObject->putDirect(exec->globalData(), Identifier(exec, Internals::internalsId), toJS(exec, globalObject, Internals::create(document)));48 if (scriptContext->isDocument()) 49 globalObject->putDirect(exec->globalData(), Identifier(exec, Internals::internalsId), toJS(exec, globalObject, Internals::create(static_cast<Document*>(scriptContext)))); 48 50 } 49 51 … … 53 55 JSLockHolder lock(exec); 54 56 JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()); 55 JSValue internalsJS = globalObject->getDirect(exec->globalData(), Identifier(exec, Internals::internalsId)); 56 if (internalsJS.isNull() || internalsJS.isEmpty()) 57 return; 58 if (Internals* internals = toInternals(internalsJS)) { 59 ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext(); 60 if (scriptContext->isDocument()) 61 internals->reset(static_cast<Document*>(scriptContext)); 62 } 57 ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext(); 58 ASSERT(scriptContext->isDocument()); 59 InternalSettings::from(static_cast<Document*>(scriptContext)->frame()->page())->reset(); 63 60 } 64 61 -
trunk/Source/WebCore/testing/v8/WebCoreTestSupport.cpp
r105900 r122326 28 28 29 29 #include "Document.h" 30 #include "InternalSettings.h" 30 31 #include "Internals.h" 31 32 #include "ScriptExecutionContext.h" … … 44 45 45 46 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); 46 Document* document = scriptContext->isDocument() ? static_cast<Document*>(scriptContext) : 0;47 context->Global()->Set(v8::String::New(Internals::internalsId), toV8(Internals::create(document)));47 if (scriptContext->isDocument()) 48 context->Global()->Set(v8::String::New(Internals::internalsId), toV8(Internals::create(static_cast<Document*>(scriptContext)))); 48 49 } 49 50 … … 57 58 v8::HandleScope scope; 58 59 59 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(context->Global()->Get(v8::String::New(Internals::internalsId))); 60 Internals* internals = object->IsUndefined() ? 0 : V8Internals::toNative(object); 61 if (internals) { 62 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); 63 if (scriptContext->isDocument()) 64 internals->reset(static_cast<Document*>(scriptContext)); 65 } 60 ScriptExecutionContext* scriptContext = getScriptExecutionContext(); 61 ASSERT(scriptContext->isDocument()); 62 InternalSettings::from(static_cast<Document*>(scriptContext)->frame()->page())->reset(); 66 63 } 67 64 -
trunk/Source/WebKit2/ChangeLog
r122325 r122326 1 2012-07-11 MORITA Hajime <morrita@google.com> 2 3 WebCoreSupport needs objects each of which follows major WebCore objects 4 https://bugs.webkit.org/show_bug.cgi?id=88499 5 6 Reviewed by Alexey Proskuryakov. 7 8 Added exporting symbols. 9 10 * win/WebKit2.def: 11 * win/WebKit2CFLite.def: 12 1 13 2012-07-11 Sheriff Bot <webkit.review.bot@gmail.com> 2 14 -
trunk/Source/WebKit2/win/WebKit2.def
r122205 r122326 256 256 ?view@Document@WebCore@@QBEPAVFrameView@2@XZ 257 257 ?willDetachPage@FrameDestructionObserver@WebCore@@UAEXXZ 258 ??1ContextDestructionObserver@WebCore@@MAE@XZ 259 ?contextDestroyed@ContextDestructionObserver@WebCore@@UAEXXZ 260 ??0ContextDestructionObserver@WebCore@@QAE@PAVScriptExecutionContext@1@@Z 258 261 ?nodesFromRect@Document@WebCore@@QBE?AV?$PassRefPtr@VNodeList@WebCore@@@WTF@@HHIIII_N0@Z 259 262 ?selectionStartHasMarkerFor@Editor@WebCore@@QBE_NW4MarkerType@DocumentMarker@2@HH@Z -
trunk/Source/WebKit2/win/WebKit2CFLite.def
r122204 r122326 149 149 ??1FrameDestructionObserver@WebCore@@MAE@XZ 150 150 ??0FrameDestructionObserver@WebCore@@QAE@PAVFrame@1@@Z 151 ??1ContextDestructionObserver@WebCore@@MAE@XZ 152 ?contextDestroyed@ContextDestructionObserver@WebCore@@UAEXXZ 153 ??0ContextDestructionObserver@WebCore@@QAE@PAVScriptExecutionContext@1@@Z 151 154 ?absoluteBoundingBoxRect@RenderObject@WebCore@@QBE?AVIntRect@2@_N@Z 152 155 ?absoluteBoundingBoxRectIgnoringTransforms@RenderObject@WebCore@@QBE?AVIntRect@2@XZ … … 262 265 ?profilerEnabled@InspectorController@WebCore@@QAE_NXZ 263 266 ?setProfilerEnabled@InspectorController@WebCore@@QAEX_N@Z 267 ??1ContextDestructionObserver@WebCore@@MAE@XZ 264 268 ?jsStringSlowCase@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@AAV?$HashMap@PAVStringImpl@WTF@@V?$Weak@VJSString@JSC@@@JSC@@U?$PtrHash@PAVStringImpl@WTF@@@2@U?$HashTraits@PAVStringImpl@WTF@@@2@U?$HashTraits@V?$Weak@VJSString@JSC@@@JSC@@@2@@WTF@@PAVStringImpl@6@@Z 265 269 ?registerURLSchemeAsBypassingContentSecurityPolicy@SchemeRegistry@WebCore@@SAXABVString@WTF@@@Z -
trunk/Source/autotools/symbols.filter
r122205 r122326 168 168 _ZN7WebCore7TextRun22setAllowsRoundingHacksEb; 169 169 _ZNK7WebCore14InsertionPoint8isActiveEv; 170 _ZN7WebCore26ContextDestructionObserverD2Ev; 171 _ZN7WebCore26ContextDestructionObserverC2EPNS_22ScriptExecutionContextE; 172 _ZN7WebCore26ContextDestructionObserver16contextDestroyedEv; 170 173 local: 171 174 _Z*;
Note: See TracChangeset
for help on using the changeset viewer.