Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Side by Side Diff: sky/engine/core/rendering/RenderView.cpp

Issue 768493002: Get rid of CompositingState. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix incorrect case. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 static inline bool rendererObscuresBackground(RenderBox* rootBox) 235 static inline bool rendererObscuresBackground(RenderBox* rootBox)
236 { 236 {
237 ASSERT(rootBox); 237 ASSERT(rootBox);
238 RenderStyle* style = rootBox->style(); 238 RenderStyle* style = rootBox->style();
239 if (style->opacity() != 1 239 if (style->opacity() != 1
240 || style->hasFilter() 240 || style->hasFilter()
241 || style->hasTransform()) 241 || style->hasTransform())
242 return false; 242 return false;
243 243
244 if (rootBox->compositingState() == PaintsIntoOwnBacking)
245 return false;
246
247 if (rootBox->style()->backgroundClip() == TextFillBox) 244 if (rootBox->style()->backgroundClip() == TextFillBox)
248 return false; 245 return false;
249 246
250 return true; 247 return true;
251 } 248 }
252 249
253 void RenderView::paintBoxDecorationBackground(PaintInfo& paintInfo, const Layout Point&) 250 void RenderView::paintBoxDecorationBackground(PaintInfo& paintInfo, const Layout Point&)
254 { 251 {
255 if (!view()) 252 if (!view())
256 return; 253 return;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 mapRectToPaintInvalidationBacking(paintInvalidationContainer, dirtyRect, &paintInvalidationState); 293 mapRectToPaintInvalidationBacking(paintInvalidationContainer, dirtyRect, &paintInvalidationState);
297 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, Inv alidationFull); 294 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, Inv alidationFull);
298 } 295 }
299 RenderBlock::invalidateTreeIfNeeded(paintInvalidationState); 296 RenderBlock::invalidateTreeIfNeeded(paintInvalidationState);
300 } 297 }
301 298
302 void RenderView::invalidatePaintForRectangle(const LayoutRect& paintInvalidation Rect) const 299 void RenderView::invalidatePaintForRectangle(const LayoutRect& paintInvalidation Rect) const
303 { 300 {
304 ASSERT(!paintInvalidationRect.isEmpty()); 301 ASSERT(!paintInvalidationRect.isEmpty());
305 302
306 if (!m_frameView) 303 if (m_frameView)
307 return;
308
309 if (layer()->compositingState() == PaintsIntoOwnBacking) {
310 layer()->paintInvalidator().setBackingNeedsPaintInvalidationInRect(paint InvalidationRect);
311 } else {
312 m_frameView->contentRectangleForPaintInvalidation(pixelSnappedIntRect(pa intInvalidationRect)); 304 m_frameView->contentRectangleForPaintInvalidation(pixelSnappedIntRect(pa intInvalidationRect));
313 }
314 } 305 }
315 306
316 void RenderView::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* sta te) const 307 void RenderView::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* sta te) const
317 { 308 {
318 // Apply our transform if we have one (because of full page zooming). 309 // Apply our transform if we have one (because of full page zooming).
319 if (!paintInvalidationContainer && layer() && layer()->transform()) 310 if (!paintInvalidationContainer && layer() && layer()->transform())
320 rect = layer()->transform()->mapRect(rect); 311 rect = layer()->transform()->mapRect(rect);
321 } 312 }
322 313
323 314
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 } 368 }
378 selRect.unite(currRect); 369 selRect.unite(currRect);
379 } 370 }
380 return pixelSnappedIntRect(selRect); 371 return pixelSnappedIntRect(selRect);
381 } 372 }
382 373
383 void RenderView::invalidatePaintForSelection() const 374 void RenderView::invalidatePaintForSelection() const
384 { 375 {
385 HashSet<RenderBlock*> processedBlocks; 376 HashSet<RenderBlock*> processedBlocks;
386 377
387 // For querying RenderLayer::compositingState()
388 // FIXME: this may be wrong. crbug.com/407416
389 DisableCompositingQueryAsserts disabler;
390
391 RenderObject* end = rendererAfterPosition(m_selectionEnd, m_selectionEndPos) ; 378 RenderObject* end = rendererAfterPosition(m_selectionEnd, m_selectionEndPos) ;
392 for (RenderObject* o = m_selectionStart; o && o != end; o = o->nextInPreOrde r()) { 379 for (RenderObject* o = m_selectionStart; o && o != end; o = o->nextInPreOrde r()) {
393 if (!o->canBeSelectionLeaf() && o != m_selectionStart && o != m_selectio nEnd) 380 if (!o->canBeSelectionLeaf() && o != m_selectionStart && o != m_selectio nEnd)
394 continue; 381 continue;
395 if (o->selectionState() == SelectionNone) 382 if (o->selectionState() == SelectionNone)
396 continue; 383 continue;
397 384
398 RenderSelectionInfo(o, true).invalidatePaint(); 385 RenderSelectionInfo(o, true).invalidatePaint();
399 386
400 // Blocks are responsible for painting line gaps and margin gaps. They m ust be examined as well. 387 // Blocks are responsible for painting line gaps and margin gaps. They m ust be examined as well.
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 cb = cb->containingBlock(); 521 cb = cb->containingBlock();
535 } 522 }
536 } 523 }
537 524
538 o = getNextOrPrevRenderObjectBasedOnDirection(o, stop, continueExploring , exploringBackwards); 525 o = getNextOrPrevRenderObjectBasedOnDirection(o, stop, continueExploring , exploringBackwards);
539 } 526 }
540 527
541 if (!m_frameView || blockPaintInvalidationMode == PaintInvalidationNothing) 528 if (!m_frameView || blockPaintInvalidationMode == PaintInvalidationNothing)
542 return; 529 return;
543 530
544 // For querying RenderLayer::compositingState()
545 // FIXME: this is wrong, selection should not cause eager invalidation. crbu g.com/407416
546 DisableCompositingQueryAsserts disabler;
547
548 // Have any of the old selected objects changed compared to the new selectio n? 531 // Have any of the old selected objects changed compared to the new selectio n?
549 for (SelectedObjectMap::iterator i = oldSelectedObjects.begin(); i != oldObj ectsEnd; ++i) { 532 for (SelectedObjectMap::iterator i = oldSelectedObjects.begin(); i != oldObj ectsEnd; ++i) {
550 RenderObject* obj = i->key; 533 RenderObject* obj = i->key;
551 RenderSelectionInfo* newInfo = newSelectedObjects.get(obj); 534 RenderSelectionInfo* newInfo = newSelectedObjects.get(obj);
552 RenderSelectionInfo* oldInfo = i->value.get(); 535 RenderSelectionInfo* oldInfo = i->value.get();
553 if (!newInfo || oldInfo->rect() != newInfo->rect() || oldInfo->state() ! = newInfo->state() || 536 if (!newInfo || oldInfo->rect() != newInfo->rect() || oldInfo->state() ! = newInfo->state() ||
554 (m_selectionStart == obj && oldStartPos != m_selectionStartPos) || 537 (m_selectionStart == obj && oldStartPos != m_selectionStartPos) ||
555 (m_selectionEnd == obj && oldEndPos != m_selectionEndPos)) { 538 (m_selectionEnd == obj && oldEndPos != m_selectionEndPos)) {
556 oldInfo->invalidatePaint(); 539 oldInfo->invalidatePaint();
557 if (newInfo) { 540 if (newInfo) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 void RenderView::getSelection(RenderObject*& startRenderer, int& startOffset, Re nderObject*& endRenderer, int& endOffset) const 573 void RenderView::getSelection(RenderObject*& startRenderer, int& startOffset, Re nderObject*& endRenderer, int& endOffset) const
591 { 574 {
592 startRenderer = m_selectionStart; 575 startRenderer = m_selectionStart;
593 startOffset = m_selectionStartPos; 576 startOffset = m_selectionStartPos;
594 endRenderer = m_selectionEnd; 577 endRenderer = m_selectionEnd;
595 endOffset = m_selectionEndPos; 578 endOffset = m_selectionEndPos;
596 } 579 }
597 580
598 void RenderView::clearSelection() 581 void RenderView::clearSelection()
599 { 582 {
600 // For querying RenderLayer::compositingState()
601 // This is correct, since destroying render objects needs to cause eager pai nt invalidations.
602 DisableCompositingQueryAsserts disabler;
603
604 layer()->invalidatePaintForBlockSelectionGaps(); 583 layer()->invalidatePaintForBlockSelectionGaps();
605 setSelection(0, -1, 0, -1, PaintInvalidationNewMinusOld); 584 setSelection(0, -1, 0, -1, PaintInvalidationNewMinusOld);
606 } 585 }
607 586
608 void RenderView::selectionStartEnd(int& startPos, int& endPos) const 587 void RenderView::selectionStartEnd(int& startPos, int& endPos) const
609 { 588 {
610 startPos = m_selectionStartPos; 589 startPos = m_selectionStartPos;
611 endPos = m_selectionEndPos; 590 endPos = m_selectionEndPos;
612 } 591 }
613 592
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 m_iframes.remove(iframe); 709 m_iframes.remove(iframe);
731 } 710 }
732 711
733 void RenderView::updateIFramesAfterLayout() 712 void RenderView::updateIFramesAfterLayout()
734 { 713 {
735 for (auto& iframe: m_iframes) 714 for (auto& iframe: m_iframes)
736 iframe->updateWidgetBounds(); 715 iframe->updateWidgetBounds();
737 } 716 }
738 717
739 } // namespace blink 718 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698