Bug 98514 - [Qt] Fix "ASSERTION FAILED: !document->inPageCache()" when loading a page
Summary: [Qt] Fix "ASSERTION FAILED: !document->inPageCache()" when loading a page
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jocelyn Turcotte
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-05 06:38 PDT by Jocelyn Turcotte
Modified: 2012-10-22 02:58 PDT (History)
10 users (show)

See Also:


Attachments
Patch (18.84 KB, patch)
2012-10-05 06:55 PDT, Jocelyn Turcotte
no flags Details | Formatted Diff | Diff
Patch (19.13 KB, patch)
2012-10-19 04:07 PDT, Jocelyn Turcotte
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jocelyn Turcotte 2012-10-05 06:38:13 PDT
[Qt] Fix "ASSERTION FAILED: !document->inPageCache()" when loading a page
Comment 1 Jocelyn Turcotte 2012-10-05 06:55:36 PDT
Created attachment 167321 [details]
Patch
Comment 2 Build Bot 2012-10-05 07:29:08 PDT
Comment on attachment 167321 [details]
Patch

Attachment 167321 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/14176534
Comment 3 Kenneth Rohde Christiansen 2012-10-05 09:00:31 PDT
Comment on attachment 167321 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=167321&action=review

is this covered by tests? ie, the restore from history?

> Source/WebCore/page/Frame.cpp:780
> +void Frame::createView(const IntSize& viewportSize, const Color& backgroundColor, bool transparent,
> +    const IntSize& fixedLayoutSize, const IntRect& fixedVisibleContentRect ,
> +    bool useFixedLayout, ScrollbarMode horizontalScrollbarMode, bool horizontalLock,
> +    ScrollbarMode verticalScrollbarMode, bool verticalLock)

Shouldnt this not just be one line

> Source/WebCore/page/Frame.h:88
> -        void createView(const IntSize&, const Color&, bool, const IntSize&, bool,
> -            ScrollbarMode = ScrollbarAuto, bool horizontalLock = false,
> +        void createView(const IntSize&, const Color&, bool,
> +            const IntSize& fixedLayoutSize = IntSize(), const IntRect& fixedVisibleContentRect = IntRect(),
> +            bool useFixedLayout = false, ScrollbarMode = ScrollbarAuto, bool horizontalLock = false,
>              ScrollbarMode = ScrollbarAuto, bool verticalLock = false);

It is getting a bit confusing with all the defaults. Doesn't some of the fixed* ones imply others? ie. if you have a fixedlayoutsize isn't that the same as useFixedLayout == true?

> Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp:271
>      const QSize preferredLayoutSize = page->preferredContentsSize();
>  
> +
>      ScrollbarMode hScrollbar = (ScrollbarMode) m_webFrame->scrollBarPolicy(Qt::Horizontal);

unrelated change?
Comment 4 Jocelyn Turcotte 2012-10-08 02:50:06 PDT
(In reply to comment #3)
> (From update of attachment 167321 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=167321&action=review
> 
> is this covered by tests? ie, the restore from history?
This assert is currently triggered by the QML tests, layout tests don't have the page cache enabled.

> 
> > Source/WebCore/page/Frame.cpp:780
> > +void Frame::createView(const IntSize& viewportSize, const Color& backgroundColor, bool transparent,
> > +    const IntSize& fixedLayoutSize, const IntRect& fixedVisibleContentRect ,
> > +    bool useFixedLayout, ScrollbarMode horizontalScrollbarMode, bool horizontalLock,
> > +    ScrollbarMode verticalScrollbarMode, bool verticalLock)
> 
> Shouldnt this not just be one line
That would be a pretty long line and I think it's more readable like this, I just aligned it to 4-spaces to make the style check happy.

> 
> > Source/WebCore/page/Frame.h:88
> > -        void createView(const IntSize&, const Color&, bool, const IntSize&, bool,
> > -            ScrollbarMode = ScrollbarAuto, bool horizontalLock = false,
> > +        void createView(const IntSize&, const Color&, bool,
> > +            const IntSize& fixedLayoutSize = IntSize(), const IntRect& fixedVisibleContentRect = IntRect(),
> > +            bool useFixedLayout = false, ScrollbarMode = ScrollbarAuto, bool horizontalLock = false,
> >              ScrollbarMode = ScrollbarAuto, bool verticalLock = false);
> 
> It is getting a bit confusing with all the defaults. Doesn't some of the fixed* ones imply others? ie. if you have a fixedlayoutsize isn't that the same as useFixedLayout == true?
Yep !fixedLayoutSize.isEmpty() || !fixedVisibleContentRect.isEmpty() requires that useFixedLayout == true.
I have to admit that this is ugly, ideally there would be a way to call those setters directly on the view from the outside in a way that wouldn't trigger a layout (before it gets attached) but this would be a much bigger change.
I could remove the useFixedLayout = false and deduce it from the above, tell me what you think.

> 
> > Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp:271
> >      const QSize preferredLayoutSize = page->preferredContentsSize();
> >  
> > +
> >      ScrollbarMode hScrollbar = (ScrollbarMode) m_webFrame->scrollBarPolicy(Qt::Horizontal);
> 
> unrelated change?
Yep I'll get that out.
Comment 5 Kenneth Rohde Christiansen 2012-10-08 06:35:15 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > (From update of attachment 167321 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=167321&action=review
> > 
> > is this covered by tests? ie, the restore from history?
> This assert is currently triggered by the QML tests, layout tests don't have the page cache enabled.
> 
> > 
> > > Source/WebCore/page/Frame.cpp:780
> > > +void Frame::createView(const IntSize& viewportSize, const Color& backgroundColor, bool transparent,
> > > +    const IntSize& fixedLayoutSize, const IntRect& fixedVisibleContentRect ,
> > > +    bool useFixedLayout, ScrollbarMode horizontalScrollbarMode, bool horizontalLock,
> > > +    ScrollbarMode verticalScrollbarMode, bool verticalLock)
> > 
> > Shouldnt this not just be one line
> That would be a pretty long line and I think it's more readable like this, I just aligned it to 4-spaces to make the style check happy.

I know and your IDE should wrap it for you :-) I think that is the current webkit style; dont wrap these lines.

> > It is getting a bit confusing with all the defaults. Doesn't some of the fixed* ones imply others? ie. if you have a fixedlayoutsize isn't that the same as useFixedLayout == true?
> Yep !fixedLayoutSize.isEmpty() || !fixedVisibleContentRect.isEmpty() requires that useFixedLayout == true.
> I have to admit that this is ugly, ideally there would be a way to call those setters directly on the view from the outside in a way that wouldn't trigger a layout (before it gets attached) but this would be a much bigger change.
> I could remove the useFixedLayout = false and deduce it from the above, tell me what you think.

Better fix it as you suggested in another patch.
Comment 6 Jocelyn Turcotte 2012-10-08 06:48:57 PDT
(In reply to comment #5)
> I know and your IDE should wrap it for you :-) I think that is the current webkit style; dont wrap these lines.

I personally find it confusing to have auto-wrapping enabled in the editor, and it's not specified in the WebKit style doc. I'd prefer to leave it like this.

> > Yep !fixedLayoutSize.isEmpty() || !fixedVisibleContentRect.isEmpty() requires that useFixedLayout == true.
> > I have to admit that this is ugly, ideally there would be a way to call those setters directly on the view from the outside in a way that wouldn't trigger a layout (before it gets attached) but this would be a much bigger change.
> > I could remove the useFixedLayout = false and deduce it from the above, tell me what you think.
> 
> Better fix it as you suggested in another patch.

I'll try it out and see if it doesn't mess things up too much, that function reaches out to every single platform.
Comment 7 Jocelyn Turcotte 2012-10-10 03:05:11 PDT
(In reply to comment #6)
> I'll try it out and see if it doesn't mess things up too much, that function reaches out to every single platform.

After investigation, the only clean way I came up with to reduce the number of parameters of Frame::createView is to allow passing a self-created FrameView to it.

The compromises that I see this would imply:
- The platforms code would now be responsible to handle some logic details like creating the FrameView using the viewportSize if it's the main frame rather than letting createView handle it, etc.
- This would open a door where a second FrameView would be active on a Frame since we can't call setView(0) before the creation.

Overall createView is just a convenience method for stuff that needs to happen on an interdependent Frame and FrameView pair when the load is about to commit. I don't think that having too many parameters passed to it outweighs the above issues, especially the second one.

If you have a better idea let me know, otherwise I think that keeping those parameters would work better. One way I see to make this less of a mess would be not to pass the useFixedLayout boolean and then call "frameView->setUseFixedLayout(!fixedLayoutSize.isEmpty());"

I also started looking at removing ScrollView::setUseFixedLayout completely and rely only on setFixedLayoutSize, though some chromium tests at least seem to be using setUseFixedLayout alone (and they have it exposed on their WebView). It would also make it less clear that giving an empty/non-empty size to setFixedLayoutSize would disable/trigger this "mode" of the FrameView.
Comment 8 Jocelyn Turcotte 2012-10-19 04:07:01 PDT
Created attachment 169596 [details]
Patch

It took some time to look at it and I think adding this parameter is the cleanest solution. Splitting createView would create too much code duplication accross platforms code.
The difference with the previous patch are the fixed exports and the unrelated empty line removed.
Comment 9 WebKit Review Bot 2012-10-22 02:58:32 PDT
Comment on attachment 169596 [details]
Patch

Clearing flags on attachment: 169596

Committed r132054: <http://trac.webkit.org/changeset/132054>
Comment 10 WebKit Review Bot 2012-10-22 02:58:37 PDT
All reviewed patches have been landed.  Closing bug.