| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // RenderViews should never be called to paint with an offset not on device
pixels. | 198 // RenderViews should never be called to paint with an offset not on device
pixels. |
| 199 ASSERT(LayoutPoint(IntPoint(paintOffset.x(), paintOffset.y())) == paintOffse
t); | 199 ASSERT(LayoutPoint(IntPoint(paintOffset.x(), paintOffset.y())) == paintOffse
t); |
| 200 | 200 |
| 201 // This avoids painting garbage between columns if there is a column gap. | 201 // This avoids painting garbage between columns if there is a column gap. |
| 202 if (m_frameView && style()->isOverflowPaged()) | 202 if (m_frameView && style()->isOverflowPaged()) |
| 203 paintInfo.context->fillRect(paintInfo.rect, m_frameView->baseBackgroundC
olor()); | 203 paintInfo.context->fillRect(paintInfo.rect, m_frameView->baseBackgroundC
olor()); |
| 204 | 204 |
| 205 paintObject(paintInfo, paintOffset, layers); | 205 paintObject(paintInfo, paintOffset, layers); |
| 206 } | 206 } |
| 207 | 207 |
| 208 static inline bool rendererObscuresBackground(RenderBox* rootBox) | |
| 209 { | |
| 210 ASSERT(rootBox); | |
| 211 RenderStyle* style = rootBox->style(); | |
| 212 if (style->opacity() != 1 | |
| 213 || style->hasFilter() | |
| 214 || style->hasTransform()) | |
| 215 return false; | |
| 216 | |
| 217 return true; | |
| 218 } | |
| 219 | |
| 220 void RenderView::paintBoxDecorationBackground(PaintInfo& paintInfo, const Layout
Point&) | 208 void RenderView::paintBoxDecorationBackground(PaintInfo& paintInfo, const Layout
Point&) |
| 221 { | 209 { |
| 222 if (!view()) | 210 if (!view()) |
| 223 return; | 211 return; |
| 224 | 212 |
| 225 bool shouldPaintBackground = true; | |
| 226 Node* documentElement = document().documentElement(); | |
| 227 if (RenderBox* rootBox = documentElement ? toRenderBox(documentElement->rend
erer()) : 0) | |
| 228 shouldPaintBackground = !rendererObscuresBackground(rootBox); | |
| 229 | |
| 230 // If painting will entirely fill the view, no need to fill the background. | |
| 231 if (!shouldPaintBackground) | |
| 232 return; | |
| 233 | |
| 234 // This code typically only executes if the root element's visibility has be
en set to hidden, | 213 // This code typically only executes if the root element's visibility has be
en set to hidden, |
| 235 // if there is a transform on the <html>, or if there is a page scale factor
less than 1. | 214 // if there is a transform on the <html>, or if there is a page scale factor
less than 1. |
| 236 // Only fill with the base background color (typically white) if we're the r
oot document, | 215 // Only fill with the base background color (typically white) if we're the r
oot document, |
| 237 // since iframes/frames with no background in the child document should show
the parent's background. | 216 // since iframes/frames with no background in the child document should show
the parent's background. |
| 238 if (!frameView()->isTransparent()) { | 217 if (!frameView()->isTransparent()) { |
| 239 Color baseColor = frameView()->baseBackgroundColor(); | 218 Color baseColor = frameView()->baseBackgroundColor(); |
| 240 if (baseColor.alpha()) { | 219 if (baseColor.alpha()) { |
| 241 CompositeOperator previousOperator = paintInfo.context->compositeOpe
ration(); | 220 CompositeOperator previousOperator = paintInfo.context->compositeOpe
ration(); |
| 242 paintInfo.context->setCompositeOperation(CompositeCopy); | 221 paintInfo.context->setCompositeOperation(CompositeCopy); |
| 243 paintInfo.context->fillRect(paintInfo.rect, baseColor); | 222 paintInfo.context->fillRect(paintInfo.rect, baseColor); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 if (m_frameView) | 341 if (m_frameView) |
| 363 return m_frameView->visibleContentRect(); | 342 return m_frameView->visibleContentRect(); |
| 364 return LayoutRect(); | 343 return LayoutRect(); |
| 365 } | 344 } |
| 366 | 345 |
| 367 IntRect RenderView::unscaledDocumentRect() const | 346 IntRect RenderView::unscaledDocumentRect() const |
| 368 { | 347 { |
| 369 return pixelSnappedIntRect(layoutOverflowRect()); | 348 return pixelSnappedIntRect(layoutOverflowRect()); |
| 370 } | 349 } |
| 371 | 350 |
| 372 bool RenderView::rootBackgroundIsEntirelyFixed() const | |
| 373 { | |
| 374 if (RenderObject* backgroundRenderer = this->backgroundRenderer()) | |
| 375 return backgroundRenderer->hasEntirelyFixedBackground(); | |
| 376 return false; | |
| 377 } | |
| 378 | |
| 379 RenderObject* RenderView::backgroundRenderer() const | |
| 380 { | |
| 381 if (Element* documentElement = document().documentElement()) | |
| 382 return documentElement->renderer(); | |
| 383 return 0; | |
| 384 } | |
| 385 | |
| 386 LayoutRect RenderView::backgroundRect(RenderBox* backgroundRenderer) const | 351 LayoutRect RenderView::backgroundRect(RenderBox* backgroundRenderer) const |
| 387 { | 352 { |
| 388 return unscaledDocumentRect(); | 353 return unscaledDocumentRect(); |
| 389 } | 354 } |
| 390 | 355 |
| 391 IntRect RenderView::documentRect() const | 356 IntRect RenderView::documentRect() const |
| 392 { | 357 { |
| 393 FloatRect overflowRect(unscaledDocumentRect()); | 358 FloatRect overflowRect(unscaledDocumentRect()); |
| 394 if (hasTransform()) | 359 if (hasTransform()) |
| 395 overflowRect = layer()->currentTransform().mapRect(overflowRect); | 360 overflowRect = layer()->currentTransform().mapRect(overflowRect); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 413 int RenderView::viewLogicalHeight() const | 378 int RenderView::viewLogicalHeight() const |
| 414 { | 379 { |
| 415 return viewHeight(); | 380 return viewHeight(); |
| 416 } | 381 } |
| 417 | 382 |
| 418 LayoutUnit RenderView::viewLogicalHeightForPercentages() const | 383 LayoutUnit RenderView::viewLogicalHeightForPercentages() const |
| 419 { | 384 { |
| 420 return viewLogicalHeight(); | 385 return viewLogicalHeight(); |
| 421 } | 386 } |
| 422 | 387 |
| 423 void RenderView::updateHitTestResult(HitTestResult& result, const LayoutPoint& p
oint) | |
| 424 { | |
| 425 if (result.innerNode()) | |
| 426 return; | |
| 427 | |
| 428 Node* node = document().documentElement(); | |
| 429 if (node) { | |
| 430 result.setInnerNode(node); | |
| 431 if (!result.innerNonSharedNode()) | |
| 432 result.setInnerNonSharedNode(node); | |
| 433 result.setLocalPoint(point); | |
| 434 } | |
| 435 } | |
| 436 | |
| 437 void RenderView::pushLayoutState(LayoutState& layoutState) | 388 void RenderView::pushLayoutState(LayoutState& layoutState) |
| 438 { | 389 { |
| 439 m_layoutState = &layoutState; | 390 m_layoutState = &layoutState; |
| 440 } | 391 } |
| 441 | 392 |
| 442 void RenderView::popLayoutState() | 393 void RenderView::popLayoutState() |
| 443 { | 394 { |
| 444 ASSERT(m_layoutState); | 395 ASSERT(m_layoutState); |
| 445 m_layoutState = m_layoutState->next(); | 396 m_layoutState = m_layoutState->next(); |
| 446 } | 397 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 467 m_iframes.remove(iframe); | 418 m_iframes.remove(iframe); |
| 468 } | 419 } |
| 469 | 420 |
| 470 void RenderView::updateIFramesAfterLayout() | 421 void RenderView::updateIFramesAfterLayout() |
| 471 { | 422 { |
| 472 for (auto& iframe: m_iframes) | 423 for (auto& iframe: m_iframes) |
| 473 iframe->updateWidgetBounds(); | 424 iframe->updateWidgetBounds(); |
| 474 } | 425 } |
| 475 | 426 |
| 476 } // namespace blink | 427 } // namespace blink |
| OLD | NEW |