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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 1328283005: Add support for multiple text decorations with same line positioning (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 5 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 | 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) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 2911 matching lines...) Expand 10 before | Expand all | Expand 10 after
2922 if (root->type() == ShadowRootType::UserAgent) { 2922 if (root->type() == ShadowRootType::UserAgent) {
2923 if (Element* shadowHost = node()->shadowHost()) { 2923 if (Element* shadowHost = node()->shadowHost()) {
2924 return shadowHost->layoutObject()->getUncachedPseudoStyle(Pseudo StyleRequest(SELECTION)); 2924 return shadowHost->layoutObject()->getUncachedPseudoStyle(Pseudo StyleRequest(SELECTION));
2925 } 2925 }
2926 } 2926 }
2927 } 2927 }
2928 2928
2929 return getUncachedPseudoStyle(PseudoStyleRequest(SELECTION)); 2929 return getUncachedPseudoStyle(PseudoStyleRequest(SELECTION));
2930 } 2930 }
2931 2931
2932 void LayoutObject::getTextDecorations(unsigned decorations, AppliedTextDecoratio n& underline, AppliedTextDecoration& overline, AppliedTextDecoration& linethroug h, bool quirksMode, bool firstlineStyle)
2933 {
2934 LayoutObject* curr = this;
2935 const ComputedStyle* styleToUse = nullptr;
2936 unsigned currDecs = TextDecorationNone;
2937 Color resultColor;
2938 TextDecorationStyle resultStyle;
2939 do {
2940 styleToUse = curr->style(firstlineStyle);
2941 currDecs = styleToUse->textDecoration();
2942 currDecs &= decorations;
2943 resultColor = styleToUse->visitedDependentColor(CSSPropertyTextDecoratio nColor);
2944 resultStyle = styleToUse->textDecorationStyle();
2945 // Parameter 'decorations' is cast as an int to enable the bitwise opera tions below.
2946 if (currDecs) {
2947 if (currDecs & TextDecorationUnderline) {
2948 decorations &= ~TextDecorationUnderline;
2949 underline.color = resultColor;
2950 underline.style = resultStyle;
2951 }
2952 if (currDecs & TextDecorationOverline) {
2953 decorations &= ~TextDecorationOverline;
2954 overline.color = resultColor;
2955 overline.style = resultStyle;
2956 }
2957 if (currDecs & TextDecorationLineThrough) {
2958 decorations &= ~TextDecorationLineThrough;
2959 linethrough.color = resultColor;
2960 linethrough.style = resultStyle;
2961 }
2962 }
2963 if (curr->isRubyText())
2964 return;
2965 curr = curr->parent();
2966 if (curr && curr->isAnonymousBlock() && toLayoutBlock(curr)->continuatio n())
2967 curr = toLayoutBlock(curr)->continuation();
2968 } while (curr && decorations && (!quirksMode || !curr->node() || (!isHTMLAnc horElement(*curr->node()) && !isHTMLFontElement(*curr->node()))));
2969
2970 // If we bailed out, use the element we bailed out at (typically a <font> or <a> element).
2971 if (decorations && curr) {
2972 styleToUse = curr->style(firstlineStyle);
2973 resultColor = styleToUse->visitedDependentColor(CSSPropertyTextDecoratio nColor);
2974 if (decorations & TextDecorationUnderline) {
2975 underline.color = resultColor;
2976 underline.style = resultStyle;
2977 }
2978 if (decorations & TextDecorationOverline) {
2979 overline.color = resultColor;
2980 overline.style = resultStyle;
2981 }
2982 if (decorations & TextDecorationLineThrough) {
2983 linethrough.color = resultColor;
2984 linethrough.style = resultStyle;
2985 }
2986 }
2987 }
2988
2989 void LayoutObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions) 2932 void LayoutObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions)
2990 { 2933 {
2991 // Convert the style regions to absolute coordinates. 2934 // Convert the style regions to absolute coordinates.
2992 if (style()->visibility() != VISIBLE || !isBox()) 2935 if (style()->visibility() != VISIBLE || !isBox())
2993 return; 2936 return;
2994 2937
2995 if (style()->getDraggableRegionMode() == DraggableRegionNone) 2938 if (style()->getDraggableRegionMode() == DraggableRegionNone)
2996 return; 2939 return;
2997 2940
2998 LayoutBox* box = toLayoutBox(this); 2941 LayoutBox* box = toLayoutBox(this);
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
3522 const blink::LayoutObject* root = object1; 3465 const blink::LayoutObject* root = object1;
3523 while (root->parent()) 3466 while (root->parent())
3524 root = root->parent(); 3467 root = root->parent();
3525 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3468 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3526 } else { 3469 } else {
3527 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3470 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3528 } 3471 }
3529 } 3472 }
3530 3473
3531 #endif 3474 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/paint/InlineTextBoxPainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698