Changeset 59956 in webkit
- Timestamp:
- May 21, 2010 1:56:24 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 57 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/fast/history/self-is-visited.html
r57292 r59956 12 12 var firstStyle = window.layoutTestController.computedStyleIncludingVisitedInfo(document.getElementById('one')); 13 13 var secondStyle = window.layoutTestController.computedStyleIncludingVisitedInfo(document.getElementById('two')); 14 if (firstStyle.color == secondStyle.color ) {14 if (firstStyle.color == secondStyle.color || firstStyle.backgroundColor == secondStyle.backgroundColor) { 15 15 document.getElementById('result').innerHTML = 'FAIL'; 16 16 return; … … 20 20 var firstStyle = window.getComputedStyle(document.getElementById('one'), ""); 21 21 var secondStyle = window.getComputedStyle(document.getElementById('two'), ""); 22 if (firstStyle.color != secondStyle.color ) {22 if (firstStyle.color != secondStyle.color || firstStyle.backgroundColor != secondStyle.backgroundColor) { 23 23 document.getElementById('result').innerHTML = 'FAIL'; 24 24 return; … … 27 27 </script> 28 28 <style> 29 :link { color: green }30 :visited { color: orange }29 :link { color: green; background-color: white } 30 :visited { color: orange; background-color: black } 31 31 </style> 32 32 </head> -
trunk/WebCore/ChangeLog
r59950 r59956 1 2010-05-21 David Hyatt <hyatt@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 https://bugs.webkit.org/show_bug.cgi?id=39420, :visited not working with background-color. 6 7 Make the RenderStyle color accessors private. This forces callers to use visitedDependentColor 8 instead (or to make the decision to become friends of the RenderStyle class in order to get access 9 to the real style information). 10 11 Modified history/self-is-visited.html to also test background colors. 12 13 * WebCore.base.exp: 14 * accessibility/AccessibilityTable.cpp: 15 (WebCore::AccessibilityTable::isTableExposableThroughAccessibility): 16 * accessibility/mac/AccessibilityObjectWrapper.mm: 17 (AXAttributeStringSetStyle): 18 * css/CSSComputedStyleDeclaration.cpp: 19 (WebCore::CSSComputedStyleDeclaration::currentColorOrValidColor): 20 * css/CSSComputedStyleDeclaration.h: 21 * css/SVGCSSStyleSelector.cpp: 22 (WebCore::colorFromSVGColorCSSValue): 23 * editing/ApplyStyleCommand.cpp: 24 (WebCore::ApplyStyleCommand::editingStyleAtPosition): 25 (WebCore::prepareEditingStyleToApplyAt): 26 (WebCore::removeStylesAddedByNode): 27 (WebCore::fontColorChangesComputedStyle): 28 (WebCore::ApplyStyleCommand::addInlineStyleIfNeeded): 29 * editing/ApplyStyleCommand.h: 30 (WebCore::): 31 * editing/CompositeEditCommand.cpp: 32 (WebCore::CompositeEditCommand::moveParagraphs): 33 (WebCore::CompositeEditCommand::breakOutOfEmptyListItem): 34 * editing/DeleteButtonController.cpp: 35 (WebCore::isDeletableElement): 36 * editing/DeleteSelectionCommand.cpp: 37 (WebCore::DeleteSelectionCommand::saveTypingStyleState): 38 * editing/InsertParagraphSeparatorCommand.cpp: 39 (WebCore::InsertParagraphSeparatorCommand::calculateStyleBeforeInsertion): 40 * editing/RemoveFormatCommand.cpp: 41 (WebCore::RemoveFormatCommand::doApply): 42 * editing/ReplaceSelectionCommand.cpp: 43 (WebCore::handleStyleSpansBeforeInsertion): 44 (WebCore::ReplaceSelectionCommand::handleStyleSpans): 45 (WebCore::ReplaceSelectionCommand::doApply): 46 * editing/SelectionController.cpp: 47 (WebCore::SelectionController::paintCaret): 48 * editing/markup.cpp: 49 (WebCore::createMarkup): 50 * page/animation/AnimationBase.cpp: 51 (WebCore::AnimationBase::ensurePropertyMap): 52 * page/animation/AnimationBase.h: 53 * page/mac/FrameMac.mm: 54 (WebCore::Frame::fontAttributesForSelectionStart): 55 * rendering/EllipsisBox.cpp: 56 (WebCore::EllipsisBox::paint): 57 (WebCore::EllipsisBox::paintSelection): 58 * rendering/InlineTextBox.cpp: 59 (WebCore::InlineTextBox::paint): 60 * rendering/RenderBox.cpp: 61 (WebCore::RenderBox::styleDidChange): 62 (WebCore::RenderBox::paintRootBoxDecorations): 63 (WebCore::RenderBox::paintBoxDecorationsWithSize): 64 * rendering/RenderBoxModelObject.cpp: 65 (WebCore::RenderBoxModelObject::paintBoxShadow): 66 * rendering/RenderFieldset.cpp: 67 (WebCore::RenderFieldset::paintBoxDecorations): 68 * rendering/RenderFileUploadControl.cpp: 69 (WebCore::RenderFileUploadControl::paintObject): 70 * rendering/RenderFrameSet.cpp: 71 (WebCore::RenderFrameSet::paintColumnBorder): 72 (WebCore::RenderFrameSet::paintRowBorder): 73 * rendering/RenderImage.cpp: 74 (WebCore::RenderImage::paintReplaced): 75 * rendering/RenderLayerBacking.cpp: 76 (WebCore::RenderLayerBacking::rendererBackgroundColor): 77 * rendering/RenderLayerBacking.h: 78 * rendering/RenderListBox.cpp: 79 (WebCore::RenderListBox::paintItemForeground): 80 (WebCore::RenderListBox::paintItemBackground): 81 * rendering/RenderListMarker.cpp: 82 (WebCore::RenderListMarker::paint): 83 * rendering/RenderMenuList.cpp: 84 (WebCore::RenderMenuList::itemStyle): 85 (WebCore::RenderMenuList::itemBackgroundColor): 86 (WebCore::RenderMenuList::menuStyle): 87 * rendering/RenderObject.cpp: 88 (WebCore::RenderObject::selectionBackgroundColor): 89 (WebCore::RenderObject::selectionForegroundColor): 90 * rendering/RenderSVGResource.cpp: 91 (WebCore::RenderSVGResource::adjustColorForPseudoRules): 92 (WebCore::RenderSVGResource::fillPaintingResource): 93 (WebCore::RenderSVGResource::strokePaintingResource): 94 * rendering/RenderSVGResource.h: 95 * rendering/RenderTable.cpp: 96 (WebCore::RenderTable::paintBoxDecorations): 97 * rendering/RenderTable.h: 98 (WebCore::RenderTable::bgColor): 99 * rendering/RenderTableCell.cpp: 100 (WebCore::RenderTableCell::paintBackgroundsBehindCell): 101 * rendering/RenderTextControl.cpp: 102 (WebCore::RenderTextControl::adjustInnerTextStyle): 103 * rendering/RenderTextControlSingleLine.cpp: 104 (WebCore::RenderTextControlSingleLine::menuStyle): 105 * rendering/RenderTheme.cpp: 106 (WebCore::RenderTheme::isControlStyled): 107 * rendering/RenderThemeMac.mm: 108 (WebCore::RenderThemeMac::paintMenuListButton): 109 * rendering/RenderTreeAsText.cpp: 110 (WebCore::RenderTreeAsText::writeRenderObject): 111 (WebCore::write): 112 * rendering/RenderTreeAsText.h: 113 * rendering/SVGInlineTextBox.cpp: 114 (WebCore::SVGInlineTextBox::paintSelection): 115 * rendering/SVGRenderTreeAsText.cpp: 116 (WebCore::writeRenderSVGTextBox): 117 * rendering/style/RenderStyle.cpp: 118 (WebCore::RenderStyle::colorIncludingFallback): 119 (WebCore::RenderStyle::visitedDependentColor): 120 * rendering/style/RenderStyle.h: 121 (WebCore::): 122 (WebCore::InheritedFlags::hasBackground): 123 (WebCore::InheritedFlags::borderLeftStyle): 124 (WebCore::InheritedFlags::borderRightStyle): 125 (WebCore::InheritedFlags::borderTopStyle): 126 (WebCore::InheritedFlags::borderBottomStyle): 127 (WebCore::InheritedFlags::textShadow): 128 (WebCore::InheritedFlags::textStrokeWidth): 129 (WebCore::InheritedFlags::hasNormalColumnGap): 130 (WebCore::InheritedFlags::borderLeftColor): 131 (WebCore::InheritedFlags::borderRightColor): 132 (WebCore::InheritedFlags::borderTopColor): 133 (WebCore::InheritedFlags::borderBottomColor): 134 (WebCore::InheritedFlags::backgroundColor): 135 (WebCore::InheritedFlags::color): 136 (WebCore::InheritedFlags::columnRuleColor): 137 (WebCore::InheritedFlags::outlineColor): 138 (WebCore::InheritedFlags::textFillColor): 139 (WebCore::InheritedFlags::textStrokeColor): 140 * svg/SVGAnimationElement.cpp: 141 (WebCore::adjustForCurrentColor): 142 1 143 2010-05-21 Beth Dakin <bdakin@apple.com> 2 144 -
trunk/WebCore/WebCore.base.exp
r59935 r59956 988 988 __ZNK7WebCore9PageCache10frameCountEv 989 989 __ZNK7WebCore9PageCache21autoreleasedPageCountEv 990 __ZNK7WebCore11RenderStyle21visitedDependentColorEi 990 991 __ZTVN7WebCore12ChromeClientE 991 992 __ZTVN7WebCore12PluginWidgetE -
trunk/WebCore/accessibility/AccessibilityTable.cpp
r56073 r59956 127 127 if (!tableStyle) 128 128 return false; 129 Color tableBGColor = tableStyle-> backgroundColor();129 Color tableBGColor = tableStyle->visitedDependentColor(CSSPropertyBackgroundColor); 130 130 131 131 // check enough of the cells to find if the table matches our criteria … … 170 170 // if the cell has a different color from the table and there is cell spacing, 171 171 // then it is probably a data table cell (spacing and colors take the place of borders) 172 Color cellColor = renderStyle-> backgroundColor();172 Color cellColor = renderStyle->visitedDependentColor(CSSPropertyBackgroundColor); 173 173 if (table->hBorderSpacing() > 0 && table->vBorderSpacing() > 0 174 174 && tableBGColor != cellColor && cellColor.alpha() != 1) -
trunk/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
r58266 r59956 316 316 317 317 // set basic colors 318 AXAttributeStringSetColor(attrString, NSAccessibilityForegroundColorTextAttribute, nsColor(style-> color()), range);319 AXAttributeStringSetColor(attrString, NSAccessibilityBackgroundColorTextAttribute, nsColor(style-> backgroundColor()), range);318 AXAttributeStringSetColor(attrString, NSAccessibilityForegroundColorTextAttribute, nsColor(style->visitedDependentColor(CSSPropertyColor)), range); 319 AXAttributeStringSetColor(attrString, NSAccessibilityBackgroundColorTextAttribute, nsColor(style->visitedDependentColor(CSSPropertyBackgroundColor)), range); 320 320 321 321 // set super/sub scripting -
trunk/WebCore/css/CSSComputedStyleDeclaration.cpp
r58360 r59956 375 375 } 376 376 377 static PassRefPtr<CSSPrimitiveValue> currentColorOrValidColor(RenderStyle* style, const Color& color) 378 { 377 PassRefPtr<CSSPrimitiveValue> CSSComputedStyleDeclaration::currentColorOrValidColor(RenderStyle* style, const Color& color) const 378 { 379 // This function does NOT look at visited information, so that computed style doesn't expose that. 379 380 if (!color.isValid()) 380 381 return CSSPrimitiveValue::createColor(style->color().rgb()); -
trunk/WebCore/css/CSSComputedStyleDeclaration.h
r58273 r59956 28 28 namespace WebCore { 29 29 30 class Color; 30 31 class CSSMutableStyleDeclaration; 32 class CSSPrimitiveValue; 31 33 class ShadowData; 32 34 … … 70 72 71 73 PassRefPtr<CSSValue> valueForShadow(const ShadowData*, int) const; 72 74 PassRefPtr<CSSPrimitiveValue> currentColorOrValidColor(RenderStyle*, const Color&) const; 75 73 76 RefPtr<Node> m_node; 74 77 PseudoId m_pseudoElementSpecifier; -
trunk/WebCore/css/SVGCSSStyleSelector.cpp
r57575 r59956 91 91 } 92 92 93 static Color colorFromSVGColorCSSValue(CSSValue* value, RenderStyle* style)93 static Color colorFromSVGColorCSSValue(CSSValue* value, const Color& fgColor) 94 94 { 95 95 ASSERT(value->isSVGColor()); … … 97 97 Color color; 98 98 if (c->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR) 99 color = style->color();99 color = fgColor; 100 100 else 101 101 color = c->color(); … … 455 455 { 456 456 HANDLE_INHERIT_AND_INITIAL(stopColor, StopColor); 457 svgstyle->setStopColor(colorFromSVGColorCSSValue(value, m_style .get()));457 svgstyle->setStopColor(colorFromSVGColorCSSValue(value, m_style->color())); 458 458 break; 459 459 } … … 461 461 { 462 462 HANDLE_INHERIT_AND_INITIAL(lightingColor, LightingColor); 463 svgstyle->setLightingColor(colorFromSVGColorCSSValue(value, m_style .get()));463 svgstyle->setLightingColor(colorFromSVGColorCSSValue(value, m_style->color())); 464 464 break; 465 465 } … … 488 488 return; 489 489 } 490 svgstyle->setFloodColor(colorFromSVGColorCSSValue(value, m_style .get()));490 svgstyle->setFloodColor(colorFromSVGColorCSSValue(value, m_style->color())); 491 491 break; 492 492 } -
trunk/WebCore/editing/ApplyStyleCommand.cpp
r59828 r59956 417 417 size_t numEditingStyleProperties = sizeof(editingStyleProperties)/sizeof(editingStyleProperties[0]); 418 418 419 PassRefPtr<CSSMutableStyleDeclaration> editingStyleAtPosition(Position pos, ShouldIncludeTypingStyle shouldIncludeTypingStyle)419 PassRefPtr<CSSMutableStyleDeclaration> ApplyStyleCommand::editingStyleAtPosition(Position pos, ShouldIncludeTypingStyle shouldIncludeTypingStyle) 420 420 { 421 421 RefPtr<CSSComputedStyleDeclaration> computedStyleAtPosition = pos.computedStyle(); … … 455 455 // If this function was modified in the future to delete all redundant properties, then add a boolean value to indicate 456 456 // which one of editingStyleAtPosition or computedStyle is called. 457 RefPtr<CSSMutableStyleDeclaration> style = editingStyleAtPosition(pos);457 RefPtr<CSSMutableStyleDeclaration> style = ApplyStyleCommand::editingStyleAtPosition(pos); 458 458 style->diff(editingStyle); 459 459 … … 473 473 ASSERT(node); 474 474 ASSERT(node->parentNode()); 475 RefPtr<CSSMutableStyleDeclaration> parentStyle = editingStyleAtPosition(Position(node->parentNode(), 0));476 RefPtr<CSSMutableStyleDeclaration> style = editingStyleAtPosition(Position(node, 0));475 RefPtr<CSSMutableStyleDeclaration> parentStyle = ApplyStyleCommand::editingStyleAtPosition(Position(node->parentNode(), 0)); 476 RefPtr<CSSMutableStyleDeclaration> style = ApplyStyleCommand::editingStyleAtPosition(Position(node, 0)); 477 477 parentStyle->diff(style.get()); 478 478 style->diff(editingStyle); … … 1758 1758 } 1759 1759 1760 static bool fontColorChangesComputedStyle( RenderStyle* computedStyle, StyleChange styleChange)1760 static bool fontColorChangesComputedStyle(const Color& computedStyleColor, StyleChange styleChange) 1761 1761 { 1762 1762 if (styleChange.applyFontColor()) { 1763 if (Color(styleChange.fontColor()) != computedStyle ->color())1763 if (Color(styleChange.fontColor()) != computedStyleColor) 1764 1764 return true; 1765 1765 } … … 1802 1802 // text somehow. Otherwise it will be a garbage node that will create problems for us 1803 1803 // most notably when we apply a blockquote style for a message reply. 1804 if (fontColorChangesComputedStyle(computedStyle , styleChange)1804 if (fontColorChangesComputedStyle(computedStyle->color(), styleChange) 1805 1805 || fontFaceChangesComputedStyle(computedStyle, styleChange) 1806 1806 || fontSizeChangesComputedStyle(computedStyle, styleChange)) { -
trunk/WebCore/editing/ApplyStyleCommand.h
r49414 r59956 35 35 class StyleChange; 36 36 37 enum ShouldIncludeTypingStyle { 38 IncludeTypingStyle, 39 IgnoreTypingStyle 40 }; 41 37 42 class ApplyStyleCommand : public CompositeEditCommand { 38 43 public: … … 51 56 return adoptRef(new ApplyStyleCommand(element, removeOnly, action)); 52 57 } 58 59 static PassRefPtr<CSSMutableStyleDeclaration> editingStyleAtPosition(Position pos, ShouldIncludeTypingStyle shouldIncludeTypingStyle = IgnoreTypingStyle); 53 60 54 61 private: … … 118 125 RefPtr<CSSMutableStyleDeclaration> getPropertiesNotInComputedStyle(CSSStyleDeclaration* style, CSSComputedStyleDeclaration* computedStyle); 119 126 120 enum ShouldIncludeTypingStyle {121 IncludeTypingStyle,122 IgnoreTypingStyle123 };124 125 PassRefPtr<CSSMutableStyleDeclaration> editingStyleAtPosition(Position, ShouldIncludeTypingStyle = IgnoreTypingStyle);126 127 void prepareEditingStyleToApplyAt(CSSMutableStyleDeclaration*, Position); 127 128 void removeStylesAddedByNode(CSSMutableStyleDeclaration*, Node*); -
trunk/WebCore/editing/CompositeEditCommand.cpp
r57957 r59956 941 941 RefPtr<CSSMutableStyleDeclaration> styleInEmptyParagraph; 942 942 if (startOfParagraphToMove == endOfParagraphToMove && preserveStyle) { 943 styleInEmptyParagraph = editingStyleAtPosition(startOfParagraphToMove.deepEquivalent(), IncludeTypingStyle);943 styleInEmptyParagraph = ApplyStyleCommand::editingStyleAtPosition(startOfParagraphToMove.deepEquivalent(), IncludeTypingStyle); 944 944 // The moved paragraph should assume the block style of the destination. 945 945 styleInEmptyParagraph->removeBlockProperties(); … … 1004 1004 return false; 1005 1005 1006 RefPtr<CSSMutableStyleDeclaration> style = editingStyleAtPosition(endingSelection().start(), IncludeTypingStyle);1006 RefPtr<CSSMutableStyleDeclaration> style = ApplyStyleCommand::editingStyleAtPosition(endingSelection().start(), IncludeTypingStyle); 1007 1007 1008 1008 Node* listNode = emptyListItem->parentNode(); -
trunk/WebCore/editing/DeleteButtonController.cpp
r53809 r59956 134 134 return false; 135 135 136 if ( style->hasBackground() && (!parentStyle->hasBackground() || style->backgroundColor() != parentStyle->backgroundColor()))136 if (renderer->hasBackground() && (!parentRenderer->hasBackground() || style->visitedDependentColor(CSSPropertyBackgroundColor) != parentStyle->visitedDependentColor(CSSPropertyBackgroundColor))) 137 137 return true; 138 138 } -
trunk/WebCore/editing/DeleteSelectionCommand.cpp
r55753 r59956 295 295 296 296 // Figure out the typing style in effect before the delete is done. 297 m_typingStyle = editingStyleAtPosition(positionBeforeTabSpan(m_selectionToDelete.start()));297 m_typingStyle = ApplyStyleCommand::editingStyleAtPosition(positionBeforeTabSpan(m_selectionToDelete.start())); 298 298 299 299 removeEnclosingAnchorStyle(m_typingStyle.get(), m_selectionToDelete.start()); … … 302 302 // We'll use this later in computeTypingStyleAfterDelete if we end up outside of a Mail blockquote 303 303 if (nearestMailBlockquote(m_selectionToDelete.start().node())) 304 m_deleteIntoBlockquoteStyle = editingStyleAtPosition(m_selectionToDelete.end());304 m_deleteIntoBlockquoteStyle = ApplyStyleCommand::editingStyleAtPosition(m_selectionToDelete.end()); 305 305 else 306 306 m_deleteIntoBlockquoteStyle = 0; -
trunk/WebCore/editing/InsertParagraphSeparatorCommand.cpp
r59591 r59956 83 83 return; 84 84 85 m_style = editingStyleAtPosition(pos, IncludeTypingStyle);85 m_style = ApplyStyleCommand::editingStyleAtPosition(pos, IncludeTypingStyle); 86 86 } 87 87 -
trunk/WebCore/editing/RemoveFormatCommand.cpp
r46914 r59956 57 57 // content that we're operating on. 58 58 Node* root = frame->selection()->rootEditableElement(); 59 RefPtr<CSSMutableStyleDeclaration> defaultStyle = editingStyleAtPosition(Position(root, 0));59 RefPtr<CSSMutableStyleDeclaration> defaultStyle = ApplyStyleCommand::editingStyleAtPosition(Position(root, 0)); 60 60 61 61 // Delete the selected content. -
trunk/WebCore/editing/ReplaceSelectionCommand.cpp
r55762 r59956 578 578 RefPtr<Node> copiedRangeStyleSpan = sourceDocumentStyleSpan->firstChild(); 579 579 580 RefPtr<CSSMutableStyleDeclaration> styleAtInsertionPos = editingStyleAtPosition(rangeCompliantEquivalent(insertionPos));580 RefPtr<CSSMutableStyleDeclaration> styleAtInsertionPos = ApplyStyleCommand::editingStyleAtPosition(rangeCompliantEquivalent(insertionPos)); 581 581 582 582 String styleText = styleAtInsertionPos->cssText(); … … 635 635 Node* blockquoteNode = isMailPasteAsQuotationNode(context) ? context : nearestMailBlockquote(context); 636 636 if (blockquoteNode) { 637 RefPtr<CSSMutableStyleDeclaration> blockquoteStyle = editingStyleAtPosition(Position(blockquoteNode, 0));638 RefPtr<CSSMutableStyleDeclaration> parentStyle = editingStyleAtPosition(Position(blockquoteNode->parentNode(), 0));637 RefPtr<CSSMutableStyleDeclaration> blockquoteStyle = ApplyStyleCommand::editingStyleAtPosition(Position(blockquoteNode, 0)); 638 RefPtr<CSSMutableStyleDeclaration> parentStyle = ApplyStyleCommand::editingStyleAtPosition(Position(blockquoteNode->parentNode(), 0)); 639 639 parentStyle->diff(blockquoteStyle.get()); 640 640 … … 795 795 796 796 if (m_matchStyle) 797 m_insertionStyle = editingStyleAtPosition(selection.start(), IncludeTypingStyle);797 m_insertionStyle = ApplyStyleCommand::editingStyleAtPosition(selection.start(), IncludeTypingStyle); 798 798 799 799 VisiblePosition visibleStart = selection.visibleStart(); -
trunk/WebCore/editing/SelectionController.cpp
r57218 r59956 1083 1083 Element* element = rootEditableElement(); 1084 1084 if (element && element->renderer()) { 1085 caretColor = element->renderer()->style()-> color();1085 caretColor = element->renderer()->style()->visitedDependentColor(CSSPropertyColor); 1086 1086 colorSpace = element->renderer()->style()->colorSpace(); 1087 1087 } -
trunk/WebCore/editing/markup.cpp
r59917 r59956 1020 1020 Node* parentOfLastClosed = lastClosed ? lastClosed->parentNode() : 0; 1021 1021 if (parentOfLastClosed && parentOfLastClosed->renderer()) { 1022 RefPtr<CSSMutableStyleDeclaration> style = editingStyleAtPosition(Position(parentOfLastClosed, 0));1022 RefPtr<CSSMutableStyleDeclaration> style = ApplyStyleCommand::editingStyleAtPosition(Position(parentOfLastClosed, 0)); 1023 1023 1024 1024 // Styles that Mail blockquotes contribute should only be placed on the Mail blockquote, to help … … 1044 1044 // span so that at paste time we can differentiate between document defaults and user 1045 1045 // applied styles. 1046 RefPtr<CSSMutableStyleDeclaration> defaultStyle = editingStyleAtPosition(Position(document->documentElement(), 0));1046 RefPtr<CSSMutableStyleDeclaration> defaultStyle = ApplyStyleCommand::editingStyleAtPosition(Position(document->documentElement(), 0)); 1047 1047 1048 1048 if (defaultStyle->length() > 0) -
trunk/WebCore/page/animation/AnimationBase.cpp
r58186 r59956 563 563 564 564 565 static voidensurePropertyMap()565 void AnimationBase::ensurePropertyMap() 566 566 { 567 567 // FIXME: This data is never destroyed. Maybe we should ref count it and toss it when the last AnimationController is destroyed? -
trunk/WebCore/page/animation/AnimationBase.h
r55576 r59956 226 226 227 227 AnimationBase* m_next; 228 229 private: 230 static void ensurePropertyMap(); 228 231 }; 229 232 -
trunk/WebCore/page/mac/FrameMac.mm
r57482 r59956 408 408 NSMutableDictionary* result = [NSMutableDictionary dictionary]; 409 409 410 if (style-> backgroundColor().isValid() && style->backgroundColor().alpha() != 0)411 [result setObject:nsColor(style-> backgroundColor()) forKey:NSBackgroundColorAttributeName];410 if (style->visitedDependentColor(CSSPropertyBackgroundColor).isValid() && style->visitedDependentColor(CSSPropertyBackgroundColor).alpha() != 0) 411 [result setObject:nsColor(style->visitedDependentColor(CSSPropertyBackgroundColor)) forKey:NSBackgroundColorAttributeName]; 412 412 413 413 if (style->font().primaryFont()->getNSFont()) 414 414 [result setObject:style->font().primaryFont()->getNSFont() forKey:NSFontAttributeName]; 415 415 416 if (style-> color().isValid() && style->color() != Color::black)417 [result setObject:nsColor(style-> color()) forKey:NSForegroundColorAttributeName];416 if (style->visitedDependentColor(CSSPropertyColor).isValid() && style->visitedDependentColor(CSSPropertyColor) != Color::black) 417 [result setObject:nsColor(style->visitedDependentColor(CSSPropertyColor)) forKey:NSForegroundColorAttributeName]; 418 418 419 419 const ShadowData* shadow = style->textShadow(); -
trunk/WebCore/rendering/EllipsisBox.cpp
r59592 r59956 32 32 GraphicsContext* context = paintInfo.context; 33 33 RenderStyle* style = m_renderer->style(m_firstLine); 34 Color textColor = style-> color();34 Color textColor = style->visitedDependentColor(CSSPropertyColor); 35 35 if (textColor != context->fillColor()) 36 36 context->setFillColor(textColor, style->colorSpace()); … … 79 79 void EllipsisBox::paintSelection(GraphicsContext* context, int tx, int ty, RenderStyle* style, const Font& font) 80 80 { 81 Color textColor = style-> color();81 Color textColor = style->visitedDependentColor(CSSPropertyColor); 82 82 Color c = m_renderer->selectionBackgroundColor(); 83 83 if (!c.isValid() || !c.alpha()) -
trunk/WebCore/rendering/InlineTextBox.cpp
r59592 r59956 456 456 } 457 457 458 Color stroke = paintInfo.forceBlackText ? Color::black : pseudoStyle->textStrokeColor(); 459 if (!stroke.isValid()) 460 stroke = pseudoStyle->color(); 458 Color stroke = paintInfo.forceBlackText ? Color::black : pseudoStyle->visitedDependentColor(CSSPropertyWebkitTextStrokeColor); 461 459 if (stroke != selectionStrokeColor) { 462 460 if (!paintSelectedTextOnly) -
trunk/WebCore/rendering/RenderBox.cpp
r59784 r59956 185 185 // Set the text color if we're the body. 186 186 if (isBody()) 187 document()->setTextColor(style()-> color());187 document()->setTextColor(style()->visitedDependentColor(CSSPropertyColor)); 188 188 } 189 189 … … 578 578 { 579 579 const FillLayer* bgLayer = style()->backgroundLayers(); 580 Color bgColor = style()-> backgroundColor();580 Color bgColor = style()->visitedDependentColor(CSSPropertyBackgroundColor); 581 581 RenderObject* bodyObject = 0; 582 if (! style()->hasBackground() && node() && node()->hasTagName(HTMLNames::htmlTag)) {582 if (!hasBackground() && node() && node()->hasTagName(HTMLNames::htmlTag)) { 583 583 // Locate the <body> element using the DOM. This is easier than trying 584 584 // to crawl around a render tree with potential :before/:after content and … … 589 589 if (bodyObject) { 590 590 bgLayer = bodyObject->style()->backgroundLayers(); 591 bgColor = bodyObject->style()-> backgroundColor();591 bgColor = bodyObject->style()->visitedDependentColor(CSSPropertyBackgroundColor); 592 592 } 593 593 } … … 650 650 // independent of the body. Go through the DOM to get to the root element's render object, 651 651 // since the root could be inline and wrapped in an anonymous block. 652 if (!isBody() || document()->documentElement()->renderer()-> style()->hasBackground())653 paintFillLayers(paintInfo, style()-> backgroundColor(), style()->backgroundLayers(), tx, ty, width, height);652 if (!isBody() || document()->documentElement()->renderer()->hasBackground()) 653 paintFillLayers(paintInfo, style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->backgroundLayers(), tx, ty, width, height); 654 654 if (style()->hasAppearance()) 655 655 theme()->paintDecorations(this, paintInfo, IntRect(tx, ty, width, height)); … … 797 797 // if we haven't already 798 798 if (!layerRenderer) { 799 bool drawingRootBackground = drawingBackground && (isRoot() || (isBody() && !document()->documentElement()->renderer()-> style()->hasBackground()));799 bool drawingRootBackground = drawingBackground && (isRoot() || (isBody() && !document()->documentElement()->renderer()->hasBackground())); 800 800 if (drawingRootBackground) { 801 801 layerRenderer = view(); -
trunk/WebCore/rendering/RenderBoxModelObject.cpp
r57482 r59956 305 305 // Set the appropriate bits for a box model object. Since all bits are cleared in styleWillChange, 306 306 // we only check for bits that could possibly be set to true. 307 setHasBoxDecorations( style()->hasBorder() || style()->hasBackground() || style()->hasAppearance() || style()->boxShadow());307 setHasBoxDecorations(hasBackground() || style()->hasBorder() || style()->hasAppearance() || style()->boxShadow()); 308 308 setInline(style()->isDisplayInlineType()); 309 309 setRelPositioned(style()->position() == RelativePosition); … … 1322 1322 } 1323 1323 1324 bool hasOpaqueBackground = s-> backgroundColor().isValid() && s->backgroundColor().alpha() == 255;1324 bool hasOpaqueBackground = s->visitedDependentColor(CSSPropertyBackgroundColor).isValid() && s->visitedDependentColor(CSSPropertyBackgroundColor).alpha() == 255; 1325 1325 for (const ShadowData* shadow = s->boxShadow(); shadow; shadow = shadow->next()) { 1326 1326 if (shadow->style() != shadowStyle) -
trunk/WebCore/rendering/RenderFieldset.cpp
r58177 r59956 137 137 paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Normal); 138 138 139 paintFillLayers(paintInfo, style()-> backgroundColor(), style()->backgroundLayers(), tx, ty, w, h);139 paintFillLayers(paintInfo, style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->backgroundLayers(), tx, ty, w, h); 140 140 paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Inset); 141 141 -
trunk/WebCore/rendering/RenderFileUploadControl.cpp
r58914 r59956 229 229 + buttonRenderer->baselinePosition(true, false); 230 230 231 paintInfo.context->setFillColor(style()-> color(), style()->colorSpace());231 paintInfo.context->setFillColor(style()->visitedDependentColor(CSSPropertyColor), style()->colorSpace()); 232 232 233 233 // Draw the filename -
trunk/WebCore/rendering/RenderFrameSet.cpp
r56718 r59956 88 88 GraphicsContext* context = paintInfo.context; 89 89 ColorSpace colorSpace = style()->colorSpace(); 90 context->fillRect(borderRect, frameSet()->hasBorderColor() ? style()-> borderLeftColor() : borderFillColor(), colorSpace);90 context->fillRect(borderRect, frameSet()->hasBorderColor() ? style()->visitedDependentColor(CSSPropertyBorderLeftColor) : borderFillColor(), colorSpace); 91 91 92 92 // Now stroke the edges but only if we have enough room to paint both edges with a little … … 108 108 GraphicsContext* context = paintInfo.context; 109 109 ColorSpace colorSpace = style()->colorSpace(); 110 context->fillRect(borderRect, frameSet()->hasBorderColor() ? style()-> borderLeftColor() : borderFillColor(), colorSpace);110 context->fillRect(borderRect, frameSet()->hasBorderColor() ? style()->visitedDependentColor(CSSPropertyBorderLeftColor) : borderFillColor(), colorSpace); 111 111 112 112 // Now stroke the edges but only if we have enough room to paint both edges with a little -
trunk/WebCore/rendering/RenderImage.cpp
r59281 r59956 398 398 if (!m_altText.isEmpty()) { 399 399 String text = document()->displayStringModifiedByEncoding(m_altText); 400 context->setFillColor(style()-> color(), style()->colorSpace());400 context->setFillColor(style()->visitedDependentColor(CSSPropertyColor), style()->colorSpace()); 401 401 int ax = tx + leftBorder + leftPad; 402 402 int ay = ty + topBorder + topPad; -
trunk/WebCore/rendering/RenderLayerBacking.cpp
r59711 r59956 63 63 64 64 static bool hasBorderOutlineOrShadow(const RenderStyle*); 65 static bool hasBoxDecorationsOrBackground(const Render Style*);65 static bool hasBoxDecorationsOrBackground(const RenderObject*); 66 66 static bool hasBoxDecorationsOrBackgroundImage(const RenderStyle*); 67 67 … … 534 534 } 535 535 536 static bool hasBoxDecorationsOrBackground(const Render Style* style)537 { 538 return hasBorderOutlineOrShadow( style) || style->hasBackground();536 static bool hasBoxDecorationsOrBackground(const RenderObject* renderer) 537 { 538 return hasBorderOutlineOrShadow(renderer->style()) || renderer->hasBackground(); 539 539 } 540 540 … … 552 552 return false; 553 553 554 RenderStyle* style = htmlObject->style(); 555 if (style->hasBackground()) 554 if (htmlObject->hasBackground()) 556 555 return true; 557 556 … … 560 559 return false; 561 560 562 style = bodyObject->style(); 563 return style->hasBackground(); 564 } 565 566 return renderer()->style()->hasBackground(); 567 } 568 569 const Color& RenderLayerBacking::rendererBackgroundColor() const 561 return bodyObject->hasBackground(); 562 } 563 564 return renderer()->hasBackground(); 565 } 566 567 const Color RenderLayerBacking::rendererBackgroundColor() const 570 568 { 571 569 // FIXME: share more code here 572 570 if (renderer()->node() && renderer()->node()->isDocumentNode()) { 573 571 RenderObject* htmlObject = renderer()->firstChild(); 574 RenderStyle* style = htmlObject->style(); 575 if (style->hasBackground()) 576 return style->backgroundColor(); 572 if (htmlObject->hasBackground()) 573 return htmlObject->style()->visitedDependentColor(CSSPropertyBackgroundColor); 577 574 578 575 RenderObject* bodyObject = htmlObject->firstChild(); 579 style = bodyObject->style(); 580 return style->backgroundColor(); 581 } 582 583 return renderer()->style()->backgroundColor(); 576 return bodyObject->style()->visitedDependentColor(CSSPropertyBackgroundColor); 577 } 578 579 return renderer()->style()->visitedDependentColor(CSSPropertyBackgroundColor); 584 580 } 585 581 … … 599 595 // or any background (color or image). 600 596 // FIXME: we could optimize layers for simple backgrounds. 601 if (hasBoxDecorationsOrBackground( style))597 if (hasBoxDecorationsOrBackground(renderObject)) 602 598 return false; 603 599 … … 709 705 // and set background color on the layer in that case, instead of allocating backing store and painting. 710 706 if (renderer()->isVideo() || is3DCanvas(renderer())) 711 return hasBoxDecorationsOrBackground(renderer() ->style());707 return hasBoxDecorationsOrBackground(renderer()); 712 708 713 709 return true; … … 719 715 { 720 716 RenderObject* renderObject = renderer(); 721 return renderObject->isImage() && !hasBoxDecorationsOrBackground(renderObject ->style());717 return renderObject->isImage() && !hasBoxDecorationsOrBackground(renderObject); 722 718 } 723 719 -
trunk/WebCore/rendering/RenderLayerBacking.h
r59711 r59956 160 160 161 161 bool rendererHasBackground() const; 162 const Color &rendererBackgroundColor() const;162 const Color rendererBackgroundColor() const; 163 163 164 164 bool hasNonCompositingContent() const; -
trunk/WebCore/rendering/RenderListBox.cpp
r58177 r59956 313 313 itemStyle = style(); 314 314 315 Color textColor = element->renderStyle() ? element->renderStyle()-> color() : style()->color();315 Color textColor = element->renderStyle() ? element->renderStyle()->visitedDependentColor(CSSPropertyColor) : style()->visitedDependentColor(CSSPropertyColor); 316 316 if (optionElement && optionElement->selected()) { 317 317 if (document()->frame()->selection()->isFocusedAndActive() && document()->focusedNode() == node()) … … 356 356 backColor = theme()->inactiveListBoxSelectionBackgroundColor(); 357 357 } else 358 backColor = element->renderStyle() ? element->renderStyle()-> backgroundColor() : style()->backgroundColor();358 backColor = element->renderStyle() ? element->renderStyle()->visitedDependentColor(CSSPropertyBackgroundColor) : style()->visitedDependentColor(CSSPropertyBackgroundColor); 359 359 360 360 // Draw the background for this list box item -
trunk/WebCore/rendering/RenderListMarker.cpp
r59950 r59956 1010 1010 } 1011 1011 1012 const Color color(style()-> color());1012 const Color color(style()->visitedDependentColor(CSSPropertyColor)); 1013 1013 context->setStrokeColor(color, style()->colorSpace()); 1014 1014 context->setStrokeStyle(SolidStroke); -
trunk/WebCore/rendering/RenderMediaControlsChromium.cpp
r59932 r59956 121 121 context->setShouldAntialias(true); 122 122 context->setStrokeStyle(SolidStroke); 123 context->setStrokeColor(style-> borderLeftColor(), DeviceColorSpace);123 context->setStrokeColor(style->visitedDependentColor(CSSPropertyBorderLeftColor), DeviceColorSpace); 124 124 context->setStrokeThickness(style->borderLeftWidth()); 125 context->setFillColor(style-> backgroundColor(), DeviceColorSpace);125 context->setFillColor(style->visitedDependentColor(CSSPropertyBackgroundColor), DeviceColorSpace); 126 126 context->drawRect(rect); 127 127 context->restore(); … … 151 151 152 152 RefPtr<Gradient> gradient = Gradient::create(sliderTopLeft, sliderTopRight); 153 Color startColor = object->style()-> color();153 Color startColor = object->style()->visitedDependentColor(CSSPropertyColor); 154 154 gradient->addColorStop(0.0, startColor); 155 155 gradient->addColorStop(1.0, Color(startColor.red() / 2, startColor.green() / 2, startColor.blue() / 2, startColor.alpha())); … … 225 225 // Draw the left border using CSS defined width and color. 226 226 context->setStrokeThickness(object->style()->borderLeftWidth()); 227 context->setStrokeColor(object->style()-> borderLeftColor().rgb(), DeviceColorSpace);227 context->setStrokeColor(object->style()->visitedDependentColor(CSSPropertyBorderLeftColor).rgb(), DeviceColorSpace); 228 228 context->drawLine(IntPoint(rect.x() + 1, rect.y()), 229 229 IntPoint(rect.x() + 1, rect.y() + rect.height())); … … 231 231 // Draw the right border using CSS defined width and color. 232 232 context->setStrokeThickness(object->style()->borderRightWidth()); 233 context->setStrokeColor(object->style()-> borderRightColor().rgb(), DeviceColorSpace);233 context->setStrokeColor(object->style()->visitedDependentColor(CSSPropertyBorderRightColor).rgb(), DeviceColorSpace); 234 234 context->drawLine(IntPoint(rect.x() + rect.width() - 1, rect.y()), 235 235 IntPoint(rect.x() + rect.width() - 1, rect.y() + rect.height())); -
trunk/WebCore/rendering/RenderMenuList.cpp
r58177 r59956 410 410 411 411 RenderStyle* style = element->renderStyle() ? element->renderStyle() : element->computedStyle(); 412 return style ? PopupMenuStyle(style-> color(), itemBackgroundColor(listIndex), style->font(), style->visibility() == VISIBLE, style->textIndent(), style->direction()) : menuStyle();412 return style ? PopupMenuStyle(style->visitedDependentColor(CSSPropertyColor), itemBackgroundColor(listIndex), style->font(), style->visibility() == VISIBLE, style->textIndent(), style->direction()) : menuStyle(); 413 413 } 414 414 … … 418 418 const Vector<Element*>& listItems = select->listItems(); 419 419 if (listIndex >= listItems.size()) 420 return style()-> backgroundColor();420 return style()->visitedDependentColor(CSSPropertyBackgroundColor); 421 421 Element* element = listItems[listIndex]; 422 422 423 423 Color backgroundColor; 424 424 if (element->renderStyle()) 425 backgroundColor = element->renderStyle()-> backgroundColor();425 backgroundColor = element->renderStyle()->visitedDependentColor(CSSPropertyBackgroundColor); 426 426 // If the item has an opaque background color, return that. 427 427 if (!backgroundColor.hasAlpha()) … … 429 429 430 430 // Otherwise, the item's background is overlayed on top of the menu background. 431 backgroundColor = style()-> backgroundColor().blend(backgroundColor);431 backgroundColor = style()->visitedDependentColor(CSSPropertyBackgroundColor).blend(backgroundColor); 432 432 if (!backgroundColor.hasAlpha()) 433 433 return backgroundColor; … … 440 440 { 441 441 RenderStyle* s = m_innerBlock ? m_innerBlock->style() : style(); 442 return PopupMenuStyle(s-> color(), s->backgroundColor(), s->font(), s->visibility() == VISIBLE, s->textIndent(), s->direction());442 return PopupMenuStyle(s->visitedDependentColor(CSSPropertyColor), s->visitedDependentColor(CSSPropertyBackgroundColor), s->font(), s->visibility() == VISIBLE, s->textIndent(), s->direction()); 443 443 } 444 444 -
trunk/WebCore/rendering/RenderObject.cpp
r59143 r59956 1383 1383 Color color; 1384 1384 if (style()->userSelect() != SELECT_NONE) { 1385 1386 if (pseudoStyle && pseudoStyle-> backgroundColor().isValid())1387 color = pseudoStyle-> backgroundColor().blendWithWhite();1385 RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(SELECTION); 1386 if (pseudoStyle && pseudoStyle->visitedDependentColor(CSSPropertyBackgroundColor).isValid()) 1387 color = pseudoStyle->visitedDependentColor(CSSPropertyBackgroundColor).blendWithWhite(); 1388 1388 else 1389 1389 color = document()->frame()->selection()->isFocusedAndActive() ? … … 1402 1402 1403 1403 if (RefPtr<RenderStyle> pseudoStyle = getUncachedPseudoStyle(SELECTION)) { 1404 color = pseudoStyle-> textFillColor();1404 color = pseudoStyle->visitedDependentColor(CSSPropertyWebkitTextFillColor); 1405 1405 if (!color.isValid()) 1406 color = pseudoStyle-> color();1406 color = pseudoStyle->visitedDependentColor(CSSPropertyColor); 1407 1407 } else 1408 1408 color = document()->frame()->selection()->isFocusedAndActive() ? -
trunk/WebCore/rendering/RenderObject.h
r59876 r59956 402 402 bool hasBoxDecorations() const { return m_paintBackground; } 403 403 bool mustRepaintBackgroundOrBorder() const; 404 bool hasBackground() const 405 { 406 Color color = style()->visitedDependentColor(CSSPropertyBackgroundColor); 407 if (color.isValid() && color.alpha() > 0) 408 return true; 409 return style()->hasBackgroundImage(); 410 } 404 411 405 412 bool needsLayout() const { return m_needsLayout || m_normalChildNeedsLayout || m_posChildNeedsLayout || m_needsPositionedMovementLayout; } -
trunk/WebCore/rendering/RenderSVGResource.cpp
r58212 r59956 45 45 } 46 46 47 static inline voidadjustColorForPseudoRules(const RenderStyle* style, bool useFillPaint, Color& color)47 inline void RenderSVGResource::adjustColorForPseudoRules(const RenderStyle* style, bool useFillPaint, Color& color) 48 48 { 49 49 if (style->insideLink() != InsideVisitedLink) … … 96 96 Color fillColor; 97 97 if (fillPaint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR) 98 fillColor = style-> color();98 fillColor = style->visitedDependentColor(CSSPropertyColor); 99 99 else 100 100 fillColor = fillPaint->color(); … … 150 150 Color strokeColor; 151 151 if (strokePaint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR) 152 strokeColor = style-> color();152 strokeColor = style->visitedDependentColor(CSSPropertyColor); 153 153 else 154 154 strokeColor = strokePaint->color(); -
trunk/WebCore/rendering/RenderSVGResource.h
r59081 r59956 45 45 }; 46 46 47 class Color; 47 48 class FloatRect; 48 49 class GraphicsContext; … … 79 80 static RenderSVGResourceSolidColor* sharedSolidPaintingResource(); 80 81 82 private: 83 static void adjustColorForPseudoRules(const RenderStyle*, bool useFillPaint, Color&); 84 81 85 protected: 82 86 void markForLayoutAndResourceInvalidation(RenderObject*); -
trunk/WebCore/rendering/RenderTable.cpp
r57355 r59956 502 502 paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Normal); 503 503 504 paintFillLayers(paintInfo, style()-> backgroundColor(), style()->backgroundLayers(), tx, ty, w, h);504 paintFillLayers(paintInfo, style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->backgroundLayers(), tx, ty, w, h); 505 505 paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Inset); 506 506 -
trunk/WebCore/rendering/RenderTable.h
r56319 r59956 26 26 #define RenderTable_h 27 27 28 #include "CSSPropertyNames.h" 28 29 #include "RenderBlock.h" 29 30 #include <wtf/Vector.h> … … 51 52 int borderBottom() const; 52 53 53 const Color & bgColor() const { return style()->backgroundColor(); }54 const Color bgColor() const { return style()->visitedDependentColor(CSSPropertyBackgroundColor); } 54 55 55 56 int outerBorderTop() const; -
trunk/WebCore/rendering/RenderTableCell.cpp
r58177 r59956 850 850 int h = height(); 851 851 852 Color c = backgroundObject->style()-> backgroundColor();852 Color c = backgroundObject->style()->visitedDependentColor(CSSPropertyBackgroundColor); 853 853 const FillLayer* bgLayer = backgroundObject->style()->backgroundLayers(); 854 854 -
trunk/WebCore/rendering/RenderTextControl.cpp
r58627 r59956 135 135 bool disabled = updateUserModifyProperty(node(), textBlockStyle); 136 136 if (disabled) 137 textBlockStyle->setColor(disabledTextColor(textBlockStyle-> color(), startStyle->backgroundColor()));137 textBlockStyle->setColor(disabledTextColor(textBlockStyle->visitedDependentColor(CSSPropertyColor), startStyle->visitedDependentColor(CSSPropertyBackgroundColor))); 138 138 } 139 139 -
trunk/WebCore/rendering/RenderTextControlSingleLine.cpp
r59236 r59956 789 789 PopupMenuStyle RenderTextControlSingleLine::menuStyle() const 790 790 { 791 return PopupMenuStyle(style()-> color(), style()->backgroundColor(), style()->font(), style()->visibility() == VISIBLE, style()->textIndent(), style()->direction());791 return PopupMenuStyle(style()->visitedDependentColor(CSSPropertyColor), style()->visitedDependentColor(CSSPropertyBackgroundColor), style()->font(), style()->visibility() == VISIBLE, style()->textIndent(), style()->direction()); 792 792 } 793 793 -
trunk/WebCore/rendering/RenderTheme.cpp
r59541 r59956 643 643 return (style->border() != border || 644 644 *style->backgroundLayers() != background || 645 style-> backgroundColor() != backgroundColor);645 style->visitedDependentColor(CSSPropertyBackgroundColor) != backgroundColor); 646 646 default: 647 647 return false; -
trunk/WebCore/rendering/RenderThemeChromiumSkia.cpp
r55714 r59956 309 309 const int bottom = rect.y() + rect.height(); 310 310 SkColor baseColor = SkColorSetARGB(0xff, 0xdd, 0xdd, 0xdd); 311 if (o-> style()->hasBackground())312 baseColor = o->style()-> backgroundColor().rgb();311 if (o->hasBackground()) 312 baseColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb(); 313 313 double h, s, l; 314 314 Color(baseColor).getHSL(h, s, l); -
trunk/WebCore/rendering/RenderThemeMac.mm
r58943 r59956 995 995 paintInfo.context->save(); 996 996 997 paintInfo.context->setFillColor(o->style()-> color(), o->style()->colorSpace());997 paintInfo.context->setFillColor(o->style()->visitedDependentColor(CSSPropertyColor), o->style()->colorSpace()); 998 998 paintInfo.context->setStrokeStyle(NoStroke); 999 999 -
trunk/WebCore/rendering/RenderTreeAsText.cpp
r59592 r59956 181 181 } 182 182 183 static voidwriteRenderObject(TextStream& ts, const RenderObject& o, RenderAsTextBehavior behavior)183 void RenderTreeAsText::writeRenderObject(TextStream& ts, const RenderObject& o, RenderAsTextBehavior behavior) 184 184 { 185 185 ts << o.renderName(); … … 430 430 writeIndent(ts, indent); 431 431 432 writeRenderObject(ts, o, behavior);432 RenderTreeAsText::writeRenderObject(ts, o, behavior); 433 433 ts << "\n"; 434 434 -
trunk/WebCore/rendering/RenderTreeAsText.h
r59069 r59956 50 50 void writeIndent(TextStream&, int indent); 51 51 52 class RenderTreeAsText { 53 // FIXME: This is a cheesy hack to allow easy access to RenderStyle colors. It won't be needed if we convert 54 // it to use visitedDependentColor instead. (This just involves rebaselining many results though, so for now it's 55 // not being done). 56 public: 57 static void writeRenderObject(TextStream& ts, const RenderObject& o, RenderAsTextBehavior behavior); 58 }; 59 52 60 // Helper function shared with SVGRenderTreeAsText 53 61 String quoteAndEscapeNonPrintables(const String&); -
trunk/WebCore/rendering/SVGInlineTextBox.cpp
r59148 r59956 478 478 return; 479 479 480 Color textColor = style-> color();480 Color textColor = style->visitedDependentColor(CSSPropertyColor); 481 481 Color color = renderer()->selectionBackgroundColor(); 482 482 if (!color.isValid() || !color.alpha()) -
trunk/WebCore/rendering/SVGRenderTreeAsText.cpp
r59148 r59956 434 434 ts << " at (" << text.x() << "," << text.y() << ") size " << box->width() << "x" << box->height() << " contains " << chunks.size() << " chunk(s)"; 435 435 436 if (text.parent() && (text.parent()->style()-> color() != text.style()->color()))437 writeNameValuePair(ts, "color", text.style()-> color().name());436 if (text.parent() && (text.parent()->style()->visitedDependentColor(CSSPropertyColor) != text.style()->visitedDependentColor(CSSPropertyColor))) 437 writeNameValuePair(ts, "color", text.style()->visitedDependentColor(CSSPropertyColor).name()); 438 438 } 439 439 -
trunk/WebCore/rendering/style/RenderStyle.cpp
r59629 r59956 996 996 } 997 997 998 static Color colorIncludingFallback(const RenderStyle* style, int colorProperty, EBorderStyle borderStyle) 998 const Color RenderStyle::colorIncludingFallback(int colorProperty, EBorderStyle borderStyle) const 999 999 { 1000 1000 Color result; 1001 1001 switch (colorProperty) { 1002 1002 case CSSPropertyBackgroundColor: 1003 return style->backgroundColor(); // Background color doesn't fall back.1003 return backgroundColor(); // Background color doesn't fall back. 1004 1004 case CSSPropertyBorderLeftColor: 1005 result = style->borderLeftColor();1006 borderStyle = style->borderLeftStyle();1005 result = borderLeftColor(); 1006 borderStyle = borderLeftStyle(); 1007 1007 break; 1008 1008 case CSSPropertyBorderRightColor: 1009 result = style->borderRightColor();1010 borderStyle = style->borderRightStyle();1009 result = borderRightColor(); 1010 borderStyle = borderRightStyle(); 1011 1011 break; 1012 1012 case CSSPropertyBorderTopColor: 1013 result = style->borderTopColor();1014 borderStyle = style->borderTopStyle();1013 result = borderTopColor(); 1014 borderStyle = borderTopStyle(); 1015 1015 break; 1016 1016 case CSSPropertyBorderBottomColor: 1017 result = style->borderBottomColor();1018 borderStyle = style->borderBottomStyle();1017 result = borderBottomColor(); 1018 borderStyle = borderBottomStyle(); 1019 1019 break; 1020 1020 case CSSPropertyColor: 1021 result = style->color();1021 result = color(); 1022 1022 break; 1023 1023 case CSSPropertyOutlineColor: 1024 result = style->outlineColor();1024 result = outlineColor(); 1025 1025 break; 1026 1026 case CSSPropertyWebkitColumnRuleColor: 1027 result = style->columnRuleColor();1027 result = columnRuleColor(); 1028 1028 break; 1029 1029 case CSSPropertyWebkitTextFillColor: 1030 result = style->textFillColor();1030 result = textFillColor(); 1031 1031 break; 1032 1032 case CSSPropertyWebkitTextStrokeColor: 1033 result = style->textStrokeColor();1033 result = textStrokeColor(); 1034 1034 break; 1035 1035 default: … … 1044 1044 result.setRGB(238, 238, 238); 1045 1045 else 1046 result = style->color();1046 result = color(); 1047 1047 } 1048 1048 … … 1050 1050 } 1051 1051 1052 Color RenderStyle::visitedDependentColor(int colorProperty) const1052 const Color RenderStyle::visitedDependentColor(int colorProperty) const 1053 1053 { 1054 1054 EBorderStyle borderStyle = borderStyleForColorProperty(this, colorProperty); 1055 Color unvisitedColor = colorIncludingFallback( this,colorProperty, borderStyle);1055 Color unvisitedColor = colorIncludingFallback(colorProperty, borderStyle); 1056 1056 if (insideLink() != InsideVisitedLink) 1057 1057 return unvisitedColor; … … 1060 1060 if (!visitedStyle) 1061 1061 return unvisitedColor; 1062 Color visitedColor = colorIncludingFallback(visitedStyle,colorProperty, borderStyle);1062 Color visitedColor = visitedStyle->colorIncludingFallback(colorProperty, borderStyle); 1063 1063 1064 1064 // Take the alpha from the unvisited color, but get the RGB values from the visited color. -
trunk/WebCore/rendering/style/RenderStyle.h
r59629 r59956 33 33 #include "CSSImageGeneratorValue.h" 34 34 #include "CSSPrimitiveValue.h" 35 #include "CSSPropertyNames.h" 35 36 #include "CSSReflectionDirection.h" 36 37 #include "CSSValueList.h" … … 114 115 115 116 class RenderStyle: public RefCounted<RenderStyle> { 116 friend class CSSStyleSelector; 117 friend class AnimationBase; // Used by CSS animations. We can't allow them to animate based off visited colors. 118 friend class ApplyStyleCommand; // Editing has to only reveal unvisited info. 119 friend class CSSStyleSelector; // Sets members directly. 120 friend class CSSComputedStyleDeclaration; // Ignores visited styles, so needs to be able to see unvisited info. 121 friend class PropertyWrapperMaybeInvalidColor; // Used by CSS animations. We can't allow them to animate based off visited colors. 122 friend class RenderSVGResource; // FIXME: Needs to alter the visited state by hand. Should clean the SVG code up and move it into RenderStyle perhaps. 123 friend class RenderTreeAsText; // FIXME: Only needed so the render tree can keep lying and dump the wrong colors. Rebaselining would allow this to be yanked. 117 124 protected: 118 125 … … 342 349 bool hasOffset() const { return surround->offset.nonZero(); } 343 350 344 bool hasBackground() const345 {346 if (backgroundColor().isValid() && backgroundColor().alpha() > 0)347 return true;348 return m_background->background().hasImage();349 }350 351 bool hasBackgroundImage() const { return m_background->background().hasImage(); } 351 352 bool hasFixedBackgroundImage() const { return m_background->background().hasFixedImage(); } … … 402 403 unsigned short borderLeftWidth() const { return surround->border.borderLeftWidth(); } 403 404 EBorderStyle borderLeftStyle() const { return surround->border.left().style(); } 404 const Color& borderLeftColor() const { return surround->border.left().color(); }405 405 bool borderLeftIsTransparent() const { return surround->border.left().isTransparent(); } 406 406 unsigned short borderRightWidth() const { return surround->border.borderRightWidth(); } 407 407 EBorderStyle borderRightStyle() const { return surround->border.right().style(); } 408 const Color& borderRightColor() const { return surround->border.right().color(); }409 408 bool borderRightIsTransparent() const { return surround->border.right().isTransparent(); } 410 409 unsigned short borderTopWidth() const { return surround->border.borderTopWidth(); } 411 410 EBorderStyle borderTopStyle() const { return surround->border.top().style(); } 412 const Color& borderTopColor() const { return surround->border.top().color(); }413 411 bool borderTopIsTransparent() const { return surround->border.top().isTransparent(); } 414 412 unsigned short borderBottomWidth() const { return surround->border.borderBottomWidth(); } 415 413 EBorderStyle borderBottomStyle() const { return surround->border.bottom().style(); } 416 const Color& borderBottomColor() const { return surround->border.bottom().color(); }417 414 bool borderBottomIsTransparent() const { return surround->border.bottom().isTransparent(); } 418 415 … … 427 424 EBorderStyle outlineStyle() const { return m_background->outline().style(); } 428 425 bool outlineStyleIsAuto() const { return m_background->outline().isAuto(); } 429 const Color& outlineColor() const { return m_background->outline().color(); } 430 426 431 427 EOverflow overflowX() const { return static_cast<EOverflow>(noninherited_flags._overflowX); } 432 428 EOverflow overflowY() const { return static_cast<EOverflow>(noninherited_flags._overflowY); } … … 452 448 int fontSize() const { return inherited->font.pixelSize(); } 453 449 454 const Color& color() const { return inherited->color; }455 450 Length textIndent() const { return rareInheritedData->indent; } 456 451 ETextAlign textAlign() const { return static_cast<ETextAlign>(inherited_flags._text_align); } … … 536 531 } 537 532 538 const Color& backgroundColor() const { return m_background->color(); }539 533 StyleImage* backgroundImage() const { return m_background->background().image(); } 540 534 EFillRepeat backgroundRepeatX() const { return static_cast<EFillRepeat>(m_background->background().repeatX()); } … … 617 611 618 612 const ShadowData* textShadow() const { return rareInheritedData->textShadow; } 619 const Color& textStrokeColor() const { return rareInheritedData->textStrokeColor; }620 613 float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; } 621 const Color& textFillColor() const { return rareInheritedData->textFillColor; }622 614 ColorSpace colorSpace() const { return static_cast<ColorSpace>(rareInheritedData->colorSpace); } 623 615 float opacity() const { return rareNonInheritedData->opacity; } … … 665 657 float columnGap() const { return rareNonInheritedData->m_multiCol->m_gap; } 666 658 bool hasNormalColumnGap() const { return rareNonInheritedData->m_multiCol->m_normalGap; } 667 const Color& columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); }668 659 EBorderStyle columnRuleStyle() const { return rareNonInheritedData->m_multiCol->m_rule.style(); } 669 660 unsigned short columnRuleWidth() const { return rareNonInheritedData->m_multiCol->ruleWidth(); } … … 1113 1104 void setChildIndex(unsigned index) { m_childIndex = index; } 1114 1105 1115 Color visitedDependentColor(int colorProperty) const;1106 const Color visitedDependentColor(int colorProperty) const; 1116 1107 1117 1108 // Initial values for all the properties … … 1213 1204 static const Vector<StyleDashboardRegion>& noneDashboardRegions(); 1214 1205 #endif 1206 1207 private: 1208 // Color accessors are all private to make sure callers use visitedDependentColor instead to access them. 1209 const Color& borderLeftColor() const { return surround->border.left().color(); } 1210 const Color& borderRightColor() const { return surround->border.right().color(); } 1211 const Color& borderTopColor() const { return surround->border.top().color(); } 1212 const Color& borderBottomColor() const { return surround->border.bottom().color(); } 1213 const Color& backgroundColor() const { return m_background->color(); } 1214 const Color& color() const { return inherited->color; } 1215 const Color& columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); } 1216 const Color& outlineColor() const { return m_background->outline().color(); } 1217 const Color& textFillColor() const { return rareInheritedData->textFillColor; } 1218 const Color& textStrokeColor() const { return rareInheritedData->textStrokeColor; } 1219 1220 const Color colorIncludingFallback(int colorProperty, EBorderStyle borderStyle) const; 1215 1221 }; 1216 1222 -
trunk/WebCore/svg/SVGAnimationElement.cpp
r59773 r59956 503 503 504 504 if (RenderObject* targetRenderer = target->renderer()) 505 value = targetRenderer->style()-> color().name();505 value = targetRenderer->style()->visitedDependentColor(CSSPropertyColor).name(); 506 506 } 507 507 -
trunk/WebKit/mac/ChangeLog
r59941 r59956 1 2010-05-21 David Hyatt <hyatt@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 https://bugs.webkit.org/show_bug.cgi?id=39420 6 7 Make sure everyone who needs to is using visitedDependentColor rather than accessing styles 8 directly. 9 10 * Misc/WebNSAttributedStringExtras.mm: 11 (+[NSAttributedString _web_attributedStringFromRange:]): 12 * WebView/WebFrame.mm: 13 (-[WebFrame _bodyBackgroundColor]): 14 1 15 2010-05-21 Oliver Hunt <oliver@apple.com> 2 16 -
trunk/WebKit/mac/Misc/WebNSAttributedStringExtras.mm
r46647 r59956 155 155 NSFont *font = style->font().primaryFont()->getNSFont(); 156 156 [attrs.get() setObject:font forKey:NSFontAttributeName]; 157 if (style-> color().isValid())158 [attrs.get() setObject:nsColor(style-> color()) forKey:NSForegroundColorAttributeName];157 if (style->visitedDependentColor(CSSPropertyColor).isValid()) 158 [attrs.get() setObject:nsColor(style->visitedDependentColor(CSSPropertyColor)) forKey:NSForegroundColorAttributeName]; 159 159 else 160 160 [attrs.get() removeObjectForKey:NSForegroundColorAttributeName]; 161 if (style-> backgroundColor().isValid())162 [attrs.get() setObject:nsColor(style-> backgroundColor()) forKey:NSBackgroundColorAttributeName];161 if (style->visitedDependentColor(CSSPropertyBackgroundColor).isValid()) 162 [attrs.get() setObject:nsColor(style->visitedDependentColor(CSSPropertyBackgroundColor)) forKey:NSBackgroundColorAttributeName]; 163 163 else 164 164 [attrs.get() removeObjectForKey:NSBackgroundColorAttributeName]; -
trunk/WebKit/mac/WebView/WebFrame.mm
r59840 r59956 1038 1038 if (!bodyRenderer) 1039 1039 return nil; 1040 Color color = bodyRenderer->style()-> backgroundColor();1040 Color color = bodyRenderer->style()->visitedDependentColor(CSSPropertyBackgroundColor); 1041 1041 if (!color.isValid()) 1042 1042 return nil;
Note: See TracChangeset
for help on using the changeset viewer.