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

Side by Side Diff: Source/core/rendering/RenderBoxModelObject.cpp

Issue 20061003: Move isValid/isCurrentColor from Color to StyleColor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 549
550 // When printing backgrounds is disabled or using economy mode, 550 // When printing backgrounds is disabled or using economy mode,
551 // change existing background colors and images to a solid white background. 551 // change existing background colors and images to a solid white background.
552 // If there's no bg color or image, leave it untouched to avoid affecting tr ansparency. 552 // If there's no bg color or image, leave it untouched to avoid affecting tr ansparency.
553 // We don't try to avoid loading the background images, because this style f lag is only set 553 // We don't try to avoid loading the background images, because this style f lag is only set
554 // when printing, and at that point we've already loaded the background imag es anyway. (To avoid 554 // when printing, and at that point we've already loaded the background imag es anyway. (To avoid
555 // loading the background images we'd have to do this check when applying st yles rather than 555 // loading the background images we'd have to do this check when applying st yles rather than
556 // while rendering.) 556 // while rendering.)
557 if (forceBackgroundToWhite) { 557 if (forceBackgroundToWhite) {
558 // Note that we can't reuse this variable below because the bgColor migh t be changed 558 // Note that we can't reuse this variable below because the bgColor migh t be changed
559 bool shouldPaintBackgroundColor = !bgLayer->next() && bgColor.isValid() && bgColor.alpha(); 559 bool shouldPaintBackgroundColor = !bgLayer->next() && bgColor.alpha();
560 if (shouldPaintBackgroundImage || shouldPaintBackgroundColor) { 560 if (shouldPaintBackgroundImage || shouldPaintBackgroundColor) {
561 bgColor = Color::white; 561 bgColor = Color::white;
562 shouldPaintBackgroundImage = false; 562 shouldPaintBackgroundImage = false;
563 } 563 }
564 } 564 }
565 565
566 bool colorVisible = bgColor.isValid() && bgColor.alpha(); 566 bool colorVisible = bgColor.alpha();
567 567
568 // Fast path for drawing simple color backgrounds. 568 // Fast path for drawing simple color backgrounds.
569 if (!isRoot && !clippedWithLocalScrolling && !shouldPaintBackgroundImage && isBorderFill && !bgLayer->next()) { 569 if (!isRoot && !clippedWithLocalScrolling && !shouldPaintBackgroundImage && isBorderFill && !bgLayer->next()) {
570 if (!colorVisible) 570 if (!colorVisible)
571 return; 571 return;
572 572
573 bool boxShadowShouldBeAppliedToBackground = this->boxShadowShouldBeAppli edToBackground(bleedAvoidance, box); 573 bool boxShadowShouldBeAppliedToBackground = this->boxShadowShouldBeAppli edToBackground(bleedAvoidance, box);
574 GraphicsContextStateSaver shadowStateSaver(*context, boxShadowShouldBeAp pliedToBackground); 574 GraphicsContextStateSaver shadowStateSaver(*context, boxShadowShouldBeAp pliedToBackground);
575 if (boxShadowShouldBeAppliedToBackground) 575 if (boxShadowShouldBeAppliedToBackground)
576 applyBoxShadowForBackground(context, this); 576 applyBoxShadowForBackground(context, this);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 default: 666 default:
667 ASSERT_NOT_REACHED(); 667 ASSERT_NOT_REACHED();
668 break; 668 break;
669 } 669 }
670 670
671 // Only fill with a base color (e.g., white) if we're the root document, sin ce iframes/frames with 671 // Only fill with a base color (e.g., white) if we're the root document, sin ce iframes/frames with
672 // no background in the child document should show the parent's background. 672 // no background in the child document should show the parent's background.
673 bool isOpaqueRoot = false; 673 bool isOpaqueRoot = false;
674 if (isRoot) { 674 if (isRoot) {
675 isOpaqueRoot = true; 675 isOpaqueRoot = true;
676 if (!bgLayer->next() && !(bgColor.isValid() && bgColor.alpha() == 255) & & view()->frameView()) { 676 if (!bgLayer->next() && !(bgColor.alpha() == 255) && view()->frameView() ) {
677 Element* ownerElement = document()->ownerElement(); 677 Element* ownerElement = document()->ownerElement();
678 if (ownerElement) { 678 if (ownerElement) {
679 if (!ownerElement->hasTagName(frameTag)) { 679 if (!ownerElement->hasTagName(frameTag)) {
680 // Locate the <body> element using the DOM. This is easier than trying 680 // Locate the <body> element using the DOM. This is easier than trying
681 // to crawl around a render tree with potential :before/:aft er content and 681 // to crawl around a render tree with potential :before/:aft er content and
682 // anonymous blocks created by inline <body> tags etc. We c an locate the <body> 682 // anonymous blocks created by inline <body> tags etc. We c an locate the <body>
683 // render object very easily via the DOM. 683 // render object very easily via the DOM.
684 HTMLElement* body = document()->body(); 684 HTMLElement* body = document()->body();
685 if (body) { 685 if (body) {
686 // Can't scroll a frameset document anyway. 686 // Can't scroll a frameset document anyway.
(...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after
2368 hasOneNormalBoxShadow = true; 2368 hasOneNormalBoxShadow = true;
2369 2369
2370 if (currentShadow->spread()) 2370 if (currentShadow->spread())
2371 return false; 2371 return false;
2372 } 2372 }
2373 2373
2374 if (!hasOneNormalBoxShadow) 2374 if (!hasOneNormalBoxShadow)
2375 return false; 2375 return false;
2376 2376
2377 Color backgroundColor = resolveColor(CSSPropertyBackgroundColor); 2377 Color backgroundColor = resolveColor(CSSPropertyBackgroundColor);
2378 if (!backgroundColor.isValid() || backgroundColor.hasAlpha()) 2378 if (backgroundColor.hasAlpha())
2379 return false; 2379 return false;
2380 2380
2381 const FillLayer* lastBackgroundLayer = style()->backgroundLayers(); 2381 const FillLayer* lastBackgroundLayer = style()->backgroundLayers();
2382 for (const FillLayer* next = lastBackgroundLayer->next(); next; next = lastB ackgroundLayer->next()) 2382 for (const FillLayer* next = lastBackgroundLayer->next(); next; next = lastB ackgroundLayer->next())
2383 lastBackgroundLayer = next; 2383 lastBackgroundLayer = next;
2384 2384
2385 if (lastBackgroundLayer->clip() != BorderFillBox) 2385 if (lastBackgroundLayer->clip() != BorderFillBox)
2386 return false; 2386 return false;
2387 2387
2388 if (lastBackgroundLayer->image() && style()->hasBorderRadius()) 2388 if (lastBackgroundLayer->image() && style()->hasBorderRadius())
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2429 if (shadow->style() != shadowStyle) 2429 if (shadow->style() != shadowStyle)
2430 continue; 2430 continue;
2431 2431
2432 IntSize shadowOffset(shadow->x(), shadow->y()); 2432 IntSize shadowOffset(shadow->x(), shadow->y());
2433 int shadowBlur = shadow->blur(); 2433 int shadowBlur = shadow->blur();
2434 int shadowSpread = shadow->spread(); 2434 int shadowSpread = shadow->spread();
2435 2435
2436 if (shadowOffset.isZero() && !shadowBlur && !shadowSpread) 2436 if (shadowOffset.isZero() && !shadowBlur && !shadowSpread)
2437 continue; 2437 continue;
2438 2438
2439 const Color& shadowColor = resolveColor(shadow->color()); 2439 const Color& shadowColor = resolveColor(shadow->color(), Color::stdShado wColor);
2440 2440
2441 if (shadow->style() == Normal) { 2441 if (shadow->style() == Normal) {
2442 RoundedRect fillRect = border; 2442 RoundedRect fillRect = border;
2443 fillRect.inflate(shadowSpread); 2443 fillRect.inflate(shadowSpread);
2444 if (fillRect.isEmpty()) 2444 if (fillRect.isEmpty())
2445 continue; 2445 continue;
2446 2446
2447 IntRect shadowRect(border.rect()); 2447 IntRect shadowRect(border.rect());
2448 shadowRect.inflate(shadowBlur + shadowSpread); 2448 shadowRect.inflate(shadowBlur + shadowSpread);
2449 shadowRect.move(shadowOffset); 2449 shadowRect.move(shadowOffset);
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
2754 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 2754 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
2755 for (RenderObject* child = startChild; child && child != endChild; ) { 2755 for (RenderObject* child = startChild; child && child != endChild; ) {
2756 // Save our next sibling as moveChildTo will clear it. 2756 // Save our next sibling as moveChildTo will clear it.
2757 RenderObject* nextSibling = child->nextSibling(); 2757 RenderObject* nextSibling = child->nextSibling();
2758 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); 2758 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert);
2759 child = nextSibling; 2759 child = nextSibling;
2760 } 2760 }
2761 } 2761 }
2762 2762
2763 } // namespace WebCore 2763 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698