Changeset 109944 in webkit


Ignore:
Timestamp:
Mar 6, 2012 12:08:56 PM (12 years ago)
Author:
Beth Dakin
Message:

https://bugs.webkit.org/show_bug.cgi?id=80351
InlineTextBox is using the wrong origin when calling
addRelevantRepaintedObject
-and corresponding-
<rdar://problem/10970221>

Reviewed by Sam Weinig.

Source/WebCore:

boxOrigin represents the actual location of the text. The adjustedPaintOffset
(which I was using previously) will only correspond to the first line in a
block of lines.

  • rendering/InlineTextBox.cpp:

(WebCore::InlineTextBox::paint):

Tools:

This test has actually been broken since revision 109273. This change makes
the test pass again, and it makes it specifically exercise the fix for this
bug.

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout.cpp:

(TestWebKitAPI::TEST):

Adjust comments in the other tests to reflect the API changes from 109273.

  • TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails.cpp:

(TestWebKitAPI::TEST):

  • TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp:

(TestWebKitAPI::NewFirstVisuallyNonEmptyLayoutFailsTest::didCreatePage):

  • TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp:

(TestWebKitAPI::NewFirstVisuallyNonEmptyLayoutFramesTest::didCreatePage):

  • TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout_Bundle.cpp:

(TestWebKitAPI::NewFirstVisuallyNonEmptyLayoutTest::didCreatePage):

  • TestWebKitAPI/Tests/WebKit2/lots-of-text.html: Added.
Location:
trunk
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r109943 r109944  
     12012-03-06  Beth Dakin  <bdakin@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=80351
     4        InlineTextBox is using the wrong origin when calling
     5        addRelevantRepaintedObject
     6        -and corresponding-
     7        <rdar://problem/10970221>
     8
     9        Reviewed by Sam Weinig.
     10
     11        boxOrigin represents the actual location of the text. The adjustedPaintOffset
     12        (which I was using previously) will only correspond to the first line in a
     13        block of lines.
     14        * rendering/InlineTextBox.cpp:
     15        (WebCore::InlineTextBox::paint):
     16
    1172012-03-06  Filip Spacek  <fspacek@rim.com>
    218
  • trunk/Source/WebCore/rendering/InlineTextBox.cpp

    r109273 r109944  
    497497        return;
    498498
    499     if (Frame* frame = renderer()->frame()) {
    500         if (Page* page = frame->page()) {
    501             // FIXME: Right now, InlineTextBoxes never call addRelevantUnpaintedObject() even though they might
    502             // legitimately be unpainted if they are waiting on a slow-loading web font. We should fix that, and
    503             // when we do, we will have to account for the fact the InlineTextBoxes do not always have unique
    504             // renderers and Page currently relies on each unpainted object having a unique renderer.
    505             if (paintInfo.phase == PaintPhaseForeground)
    506                 page->addRelevantRepaintedObject(renderer(), IntRect(adjustedPaintOffset.x(), adjustedPaintOffset.y(), logicalWidth(), logicalHeight()));
    507         }
    508     }
    509 
    510499    if (m_truncation != cNoTruncation) {
    511500        if (renderer()->containingBlock()->style()->isLeftToRightDirection() != isLeftToRightDirection()) {
     
    572561        if (haveSelection && !useCustomUnderlines)
    573562            paintSelection(context, boxOrigin, styleToUse, font);
     563    }
     564
     565    if (Frame* frame = renderer()->frame()) {
     566        if (Page* page = frame->page()) {
     567            // FIXME: Right now, InlineTextBoxes never call addRelevantUnpaintedObject() even though they might
     568            // legitimately be unpainted if they are waiting on a slow-loading web font. We should fix that, and
     569            // when we do, we will have to account for the fact the InlineTextBoxes do not always have unique
     570            // renderers and Page currently relies on each unpainted object having a unique renderer.
     571            if (paintInfo.phase == PaintPhaseForeground)
     572                page->addRelevantRepaintedObject(renderer(), IntRect(boxOrigin.x(), boxOrigin.y(), logicalWidth(), logicalHeight()));
     573        }
    574574    }
    575575
  • trunk/Tools/ChangeLog

    r109938 r109944  
     12012-03-06  Beth Dakin  <bdakin@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=80351
     4        InlineTextBox is using the wrong origin when calling
     5        addRelevantRepaintedObject
     6        -and corresponding-
     7        <rdar://problem/10970221>
     8
     9        Reviewed by Sam Weinig.
     10
     11        This test has actually been broken since revision 109273. This change makes
     12        the test pass again, and it makes it specifically exercise the fix for this
     13        bug.
     14        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     15        * TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout.cpp:
     16        (TestWebKitAPI::TEST):
     17
     18        Adjust comments in the other tests to reflect the API changes from 109273.
     19        * TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails.cpp:
     20        (TestWebKitAPI::TEST):
     21        * TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp:
     22        (TestWebKitAPI::NewFirstVisuallyNonEmptyLayoutFailsTest::didCreatePage):
     23        * TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp:
     24        (TestWebKitAPI::NewFirstVisuallyNonEmptyLayoutFramesTest::didCreatePage):
     25        * TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout_Bundle.cpp:
     26        (TestWebKitAPI::NewFirstVisuallyNonEmptyLayoutTest::didCreatePage):
     27        * TestWebKitAPI/Tests/WebKit2/lots-of-text.html: Added.
     28
    1292012-03-06  Hans Wennborg  <hans@chromium.org>
    230
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r109004 r109944  
    4444                52E5CE4914D21EAB003B2BD8 /* ParentFrame_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52E5CE4814D21EAB003B2BD8 /* ParentFrame_Bundle.cpp */; };
    4545                81B50193140F232300D9EB58 /* StringBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81B50192140F232300D9EB58 /* StringBuilder.cpp */; };
     46                930AD402150698D00067970F /* lots-of-text.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 930AD401150698B30067970F /* lots-of-text.html */; };
    4647                9361002914DC95A70061379D /* lots-of-iframes.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9361002814DC957B0061379D /* lots-of-iframes.html */; };
    4748                939BA91714103412001A01BD /* DeviceScaleFactorOnBack.mm in Sources */ = {isa = PBXBuildFile; fileRef = 939BA91614103412001A01BD /* DeviceScaleFactorOnBack.mm */; };
     
    158159                                C07E6CB213FD73930038B22B /* devicePixelRatio.html in Copy Resources */,
    159160                                9361002914DC95A70061379D /* lots-of-iframes.html in Copy Resources */,
     161                                930AD402150698D00067970F /* lots-of-text.html in Copy Resources */,
    160162                                33E79E06137B5FD900E32D99 /* mouse-move-listener.html in Copy Resources */,
    161163                                F6FDDDD614241C6F004F1729 /* push-state.html in Copy Resources */,
     
    213215                81B50192140F232300D9EB58 /* StringBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringBuilder.cpp; path = WTF/StringBuilder.cpp; sourceTree = "<group>"; };
    214216                8DD76FA10486AA7600D96B5E /* TestWebKitAPI */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TestWebKitAPI; sourceTree = BUILT_PRODUCTS_DIR; };
     217                930AD401150698B30067970F /* lots-of-text.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "lots-of-text.html"; sourceTree = "<group>"; };
    215218                9361002814DC957B0061379D /* lots-of-iframes.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "lots-of-iframes.html"; sourceTree = "<group>"; };
    216219                939BA91614103412001A01BD /* DeviceScaleFactorOnBack.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DeviceScaleFactorOnBack.mm; sourceTree = "<group>"; };
     
    523526                                BCBD372E125ABBE600D2C29F /* icon.png */,
    524527                                9361002814DC957B0061379D /* lots-of-iframes.html */,
     528                                930AD401150698B30067970F /* lots-of-text.html */,
    525529                                33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */,
    526530                                F6FDDDD514241C48004F1729 /* push-state.html */,
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout.cpp

    r106577 r109944  
    5555    setPageLoaderClient(webView.page());
    5656
    57     WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("simple", "html")).get());
     57    // This test is expected to succeed because lots-of-text.html is a large document and the relevant painted
     58    // objects take up more than 10% of the view.
     59    WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("lots-of-text", "html")).get());
    5860
    5961    Util::run(&didNewFirstVisuallyNonEmptyLayoutSucceed);
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails.cpp

    r106577 r109944  
    7272    setPageLoaderClient(webView.page());
    7373
     74    // This test is expected to fail because simple.html is a small document and the relevant painted
     75    // objects take up less than 10% of the view.
    7476    WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("simple", "html")).get());
    7577
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp

    r106577 r109944  
    4242    virtual void didCreatePage(WKBundleRef bundle, WKBundlePageRef page)
    4343    {
    44         // Set the painted objects counter to something huge that should not
    45         // cause didNewFirstVisuallyNonEmptyLayout to fire.
    46         WKBundlePageSetPaintedObjectsCounterThreshold(page, 1000);
     44        // Setting the painted objects counter is necessary at this time to opt into
     45        // the didNewFirstVisuallyNonEmptyLayout heuristic.
     46        WKBundlePageSetPaintedObjectsCounterThreshold(page, 1);
    4747    }
    4848   
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp

    r106725 r109944  
    4242    virtual void didCreatePage(WKBundleRef bundle, WKBundlePageRef page)
    4343    {
    44         // Set the painted objects counter to something small that will
    45         // cause didNewFirstVisuallyNonEmptyLayout to fire.
     44        // Setting the painted objects counter is necessary at this time to opt into
     45        // the didNewFirstVisuallyNonEmptyLayout heuristic.
    4646        WKBundlePageSetPaintedObjectsCounterThreshold(page, 1);
    4747    }
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout_Bundle.cpp

    r106577 r109944  
    4242    virtual void didCreatePage(WKBundleRef bundle, WKBundlePageRef page)
    4343    {
    44         // Set the painted objects counter to something low that should definintely
    45         // cause didNewFirstVisuallyNonEmptyLayout to fire.
     44        // Setting the painted objects counter is necessary at this time to opt into
     45        // the didNewFirstVisuallyNonEmptyLayout heuristic.
    4646        WKBundlePageSetPaintedObjectsCounterThreshold(page, 1);
    4747    }
Note: See TracChangeset for help on using the changeset viewer.