Commit 9f58d104 authored by mitz@apple.com's avatar mitz@apple.com

WebCore:

        Reviewed by Dave Hyatt.

        - fix <rdar://problem/6805567> REGRESSION (r42348): Notes flicker white
          when loading

        Tests: fast/frames/content-opacity-1.html
               fast/frames/content-opacity-2.html

        * page/FrameView.cpp:
        (WebCore::FrameView::reset): Reset m_contentIsOpaque to false.
        (WebCore::FrameView::useSlowRepaints): Use slow repaints if the content
        is not known to be opaque.
        (WebCore::FrameView::setContentIsOpaque): Added. Sets m_contentIsOpaque
        and enables or disables fast repaints accordingly.
        * page/FrameView.h:
        * rendering/RenderBoxModelObject.cpp:
        (WebCore::RenderBoxModelObject::paintFillLayerExtended): Removed the
        document()->haveStylesheetsLoaded() condition in determining whether the
        root is opaque. This is what was causing the bug, as iframes were
        considered to be opaque, and thus painted an opaque white background,
        whenever they were pending a style sheet load.
        Changed to call FrameView::setContentIsOpaqe() instead of
        setUseSlowRepaints(), which allows the frame to go back to fast repaints
        if the content becomes opaque.
        Corrected the check for background color opacity: any alpha value other
        than 255--not just zero--is not opaque.

LayoutTests:

        Reviewed by Dave Hyatt.

        - tests for <rdar://problem/6805567> REGRESSION (r42348): Notes flicker
          white when loading

        * fast/frames/content-opacity-1.html: Added.
        * fast/frames/content-opacity-2.html: Added.
        * platform/mac/fast/frames/content-opacity-1-expected.checksum: Added.
        * platform/mac/fast/frames/content-opacity-1-expected.png: Added.
        * platform/mac/fast/frames/content-opacity-1-expected.txt: Added.
        * platform/mac/fast/frames/content-opacity-2-expected.checksum: Added.
        * platform/mac/fast/frames/content-opacity-2-expected.png: Added.
        * platform/mac/fast/frames/content-opacity-2-expected.txt: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@43646 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent dc3bb22c
2009-05-13 Dan Bernstein <mitz@apple.com>
Reviewed by Dave Hyatt.
- tests for <rdar://problem/6805567> REGRESSION (r42348): Notes flicker
white when loading
* fast/frames/content-opacity-1.html: Added.
* fast/frames/content-opacity-2.html: Added.
* platform/mac/fast/frames/content-opacity-1-expected.checksum: Added.
* platform/mac/fast/frames/content-opacity-1-expected.png: Added.
* platform/mac/fast/frames/content-opacity-1-expected.txt: Added.
* platform/mac/fast/frames/content-opacity-2-expected.checksum: Added.
* platform/mac/fast/frames/content-opacity-2-expected.png: Added.
* platform/mac/fast/frames/content-opacity-2-expected.txt: Added.
2009-05-13 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin Adler.
<div style="float: left; background-image: url(../replaced/resources/1x1-green.png)">
<iframe src="data:text/html,
<body style='background-color: rgba(0, 0, 0, 0.5)'>
</body>
"></iframe>
</div>
<div style="float: left; background-image: url(../replaced/resources/1x1-green.png)">
<iframe id="iframe" onload="test()" src="data:text/html,
<html><head></head><body></body></html>
"></iframe>
<script>
function test()
{
if (window.layoutTestController)
layoutTestController.waitUntilDone();
setTimeout(function()
{
var doc = document.getElementById("iframe").contentDocument;
var link = doc.createElement("link");
link.setAttribute("rel", "stylesheet");
link.setAttribute("href", "data:text/css,/* This loads asynchronously */");
doc.documentElement.firstChild.appendChild(link);
if (window.layoutTestController)
layoutTestController.notifyDone();
}, 100);
}
</script>
</div>
a28a2b630977e47f31e5580a9b142c57
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderBlock (floating) {DIV} at (0,0) size 304x154
RenderPartObject {IFRAME} at (0,0) size 304x154 [border: (2px inset #000000)]
layer at (0,0) size 300x150
RenderView at (0,0) size 300x150
layer at (0,0) size 300x150
RenderBlock {HTML} at (0,0) size 300x150
RenderBody {BODY} at (8,8) size 284x134 [bgcolor=#0000007F]
RenderText {#text} at (0,0) size 0x0
865d8e56e7cdb9a47efd22d9a09eb56e
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderBlock (floating) {DIV} at (0,0) size 304x154
RenderPartObject {IFRAME} at (0,0) size 304x154 [border: (2px inset #000000)]
layer at (0,0) size 300x150
RenderView at (0,0) size 300x150
layer at (0,0) size 300x150
RenderBlock {HTML} at (0,0) size 300x150
RenderBody {BODY} at (8,8) size 284x134
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
2009-05-13 Dan Bernstein <mitz@apple.com>
Reviewed by Dave Hyatt.
- fix <rdar://problem/6805567> REGRESSION (r42348): Notes flicker white
when loading
Tests: fast/frames/content-opacity-1.html
fast/frames/content-opacity-2.html
* page/FrameView.cpp:
(WebCore::FrameView::reset): Reset m_contentIsOpaque to false.
(WebCore::FrameView::useSlowRepaints): Use slow repaints if the content
is not known to be opaque.
(WebCore::FrameView::setContentIsOpaque): Added. Sets m_contentIsOpaque
and enables or disables fast repaints accordingly.
* page/FrameView.h:
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintFillLayerExtended): Removed the
document()->haveStylesheetsLoaded() condition in determining whether the
root is opaque. This is what was causing the bug, as iframes were
considered to be opaque, and thus painted an opaque white background,
whenever they were pending a style sheet load.
Changed to call FrameView::setContentIsOpaqe() instead of
setUseSlowRepaints(), which allows the frame to go back to fast repaints
if the content becomes opaque.
Corrected the check for background color opacity: any alpha value other
than 255--not just zero--is not opaque.
2009-05-13 Ariya Hidayat <ariya.hidayat@nokia.com>
Reviewed by Sam Weinig.
......@@ -172,6 +172,7 @@ void FrameView::reset()
{
m_useSlowRepaints = false;
m_isOverlapped = false;
m_contentIsOpaque = false;
m_borderX = 30;
m_borderY = 30;
m_layoutTimer.stop();
......@@ -684,7 +685,7 @@ String FrameView::mediaType() const
bool FrameView::useSlowRepaints() const
{
return m_useSlowRepaints || m_slowRepaintObjectCount > 0 || m_isOverlapped;
return m_useSlowRepaints || m_slowRepaintObjectCount > 0 || m_isOverlapped || !m_contentIsOpaque;
}
void FrameView::setUseSlowRepaints()
......@@ -717,6 +718,15 @@ void FrameView::setIsOverlapped(bool isOverlapped)
setCanBlitOnScroll(!useSlowRepaints());
}
void FrameView::setContentIsOpaque(bool contentIsOpaque)
{
if (contentIsOpaque == m_contentIsOpaque)
return;
m_contentIsOpaque = contentIsOpaque;
setCanBlitOnScroll(!useSlowRepaints());
}
void FrameView::restoreScrollbar()
{
setScrollbarsSuppressed(false);
......
......@@ -144,6 +144,7 @@ public:
void setUseSlowRepaints();
void setIsOverlapped(bool);
void setContentIsOpaque(bool);
void addSlowRepaintObject();
void removeSlowRepaintObject();
......@@ -233,6 +234,7 @@ private:
ScrollbarMode m_hmode;
bool m_useSlowRepaints;
bool m_isOverlapped;
bool m_contentIsOpaque;
unsigned m_slowRepaintObjectCount;
int m_borderX, m_borderY;
......
......@@ -339,37 +339,34 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
// Only fill with a base color (e.g., white) if we're the root document, since iframes/frames with
// no background in the child document should show the parent's background.
bool isTransparent = false;
if (!bgLayer->next() && isRoot() && !(bgColor.isValid() && bgColor.alpha() > 0) && view()->frameView()) {
Node* elt = document()->ownerElement();
if (elt) {
if (!elt->hasTagName(frameTag) && document()->haveStylesheetsLoaded()) {
// Locate the <body> element using the DOM. This is easier than trying
// to crawl around a render tree with potential :before/:after content and
// anonymous blocks created by inline <body> tags etc. We can locate the <body>
// render object very easily via the DOM.
HTMLElement* body = document()->body();
if (body) {
// Can't scroll a frameset document anyway.
isTransparent = !body->hasLocalName(framesetTag);
} else {
// <html> will get a <body> eventually anyway, so we'll just wait for that.
isTransparent = document()->documentElement() && !document()->documentElement()->hasLocalName(htmlTag);
bool isOpaqueRoot = false;
if (isRoot()) {
isOpaqueRoot = true;
if (!bgLayer->next() && !(bgColor.isValid() && bgColor.alpha() == 255) && view()->frameView()) {
Element* ownerElement = document()->ownerElement();
if (ownerElement) {
if (!ownerElement->hasTagName(frameTag)) {
// Locate the <body> element using the DOM. This is easier than trying
// to crawl around a render tree with potential :before/:after content and
// anonymous blocks created by inline <body> tags etc. We can locate the <body>
// render object very easily via the DOM.
HTMLElement* body = document()->body();
if (body) {
// Can't scroll a frameset document anyway.
isOpaqueRoot = body->hasLocalName(framesetTag);
}
}
}
} else
isTransparent = view()->frameView()->isTransparent();
// FIXME: This needs to be dynamic. We should be able to go back to blitting if we ever stop being transparent.
if (isTransparent)
view()->frameView()->setUseSlowRepaints(); // The parent must show behind the child.
} else
isOpaqueRoot = !view()->frameView()->isTransparent();
}
view()->frameView()->setContentIsOpaque(isOpaqueRoot);
}
// Paint the color first underneath all images.
if (!bgLayer->next()) {
IntRect rect(tx, clipY, w, clipH);
// If we have an alpha and we are painting the root element, go ahead and blend with the base background color.
if (isRoot() && (!bgColor.isValid() || bgColor.alpha() < 0xFF) && !isTransparent) {
if (isOpaqueRoot) {
Color baseColor = view()->frameView()->baseBackgroundColor();
if (baseColor.alpha() > 0) {
context->save();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment