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

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2891003002: Store border-image-* on SurroundData in ComputedStyle (Closed)
Patch Set: Store border-image-* on SurroundData in ComputedStyle Created 3 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
4 * reserved. 4 * reserved.
5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 *other.rare_non_inherited_data_.Get())) 1002 *other.rare_non_inherited_data_.Get()))
1003 diff.SetFilterChanged(); 1003 diff.SetFilterChanged();
1004 } 1004 }
1005 1005
1006 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) { 1006 if (rare_non_inherited_data_.Get() != other.rare_non_inherited_data_.Get()) {
1007 if (!rare_non_inherited_data_->outline_.VisuallyEqual( 1007 if (!rare_non_inherited_data_->outline_.VisuallyEqual(
1008 other.rare_non_inherited_data_->outline_)) 1008 other.rare_non_inherited_data_->outline_))
1009 diff.SetNeedsRecomputeOverflow(); 1009 diff.SetNeedsRecomputeOverflow();
1010 } 1010 }
1011 1011
1012 if (!Border().VisualOverflowEqual(other.Border())) 1012 if (!BorderVisualOverflowEqual(other))
1013 diff.SetNeedsRecomputeOverflow(); 1013 diff.SetNeedsRecomputeOverflow();
1014 1014
1015 if (!diff.NeedsFullPaintInvalidation()) { 1015 if (!diff.NeedsFullPaintInvalidation()) {
1016 if (inherited_data_->color_ != other.inherited_data_->color_ || 1016 if (inherited_data_->color_ != other.inherited_data_->color_ ||
1017 inherited_data_->visited_link_color_ != 1017 inherited_data_->visited_link_color_ !=
1018 other.inherited_data_->visited_link_color_ || 1018 other.inherited_data_->visited_link_color_ ||
1019 HasSimpleUnderlineInternal() != other.HasSimpleUnderlineInternal() || 1019 HasSimpleUnderlineInternal() != other.HasSimpleUnderlineInternal() ||
1020 visual_data_->text_decoration_ != 1020 visual_data_->text_decoration_ !=
1021 other.visual_data_->text_decoration_) { 1021 other.visual_data_->text_decoration_) {
1022 diff.SetTextDecorationOrColorChanged(); 1022 diff.SetTextDecorationOrColorChanged();
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 } 1371 }
1372 1372
1373 bool ComputedStyle::TextShadowDataEquivalent(const ComputedStyle& other) const { 1373 bool ComputedStyle::TextShadowDataEquivalent(const ComputedStyle& other) const {
1374 return DataEquivalent(TextShadow(), other.TextShadow()); 1374 return DataEquivalent(TextShadow(), other.TextShadow());
1375 } 1375 }
1376 1376
1377 void ComputedStyle::SetBoxShadow(RefPtr<ShadowList> s) { 1377 void ComputedStyle::SetBoxShadow(RefPtr<ShadowList> s) {
1378 rare_non_inherited_data_.Access()->box_shadow_ = std::move(s); 1378 rare_non_inherited_data_.Access()->box_shadow_ = std::move(s);
1379 } 1379 }
1380 1380
1381 static FloatRoundedRect::Radii CalcRadiiFor(const BorderData& border, 1381 static FloatRoundedRect::Radii CalcRadiiFor(const LengthSize& top_left,
1382 const LengthSize& top_left,
1383 const LengthSize& top_right, 1382 const LengthSize& top_right,
1384 const LengthSize& bottom_left, 1383 const LengthSize& bottom_left,
1385 const LengthSize& bottom_right, 1384 const LengthSize& bottom_right,
1386 LayoutSize size) { 1385 LayoutSize size) {
1387 return FloatRoundedRect::Radii( 1386 return FloatRoundedRect::Radii(
1388 FloatSize( 1387 FloatSize(
1389 FloatValueForLength(top_left.Width(), size.Width().ToFloat()), 1388 FloatValueForLength(top_left.Width(), size.Width().ToFloat()),
1390 FloatValueForLength(top_left.Height(), size.Height().ToFloat())), 1389 FloatValueForLength(top_left.Height(), size.Height().ToFloat())),
1391 FloatSize( 1390 FloatSize(
1392 FloatValueForLength(top_right.Width(), size.Width().ToFloat()), 1391 FloatValueForLength(top_right.Width(), size.Width().ToFloat()),
(...skipping 20 matching lines...) Expand all
1413 void ComputedStyle::SetColor(const Color& v) { 1412 void ComputedStyle::SetColor(const Color& v) {
1414 SET_VAR(inherited_data_, color_, v); 1413 SET_VAR(inherited_data_, color_, v);
1415 } 1414 }
1416 1415
1417 FloatRoundedRect ComputedStyle::GetRoundedBorderFor( 1416 FloatRoundedRect ComputedStyle::GetRoundedBorderFor(
1418 const LayoutRect& border_rect, 1417 const LayoutRect& border_rect,
1419 bool include_logical_left_edge, 1418 bool include_logical_left_edge,
1420 bool include_logical_right_edge) const { 1419 bool include_logical_right_edge) const {
1421 FloatRoundedRect rounded_rect(PixelSnappedIntRect(border_rect)); 1420 FloatRoundedRect rounded_rect(PixelSnappedIntRect(border_rect));
1422 if (HasBorderRadius()) { 1421 if (HasBorderRadius()) {
1423 FloatRoundedRect::Radii radii = 1422 FloatRoundedRect::Radii radii = CalcRadiiFor(
1424 CalcRadiiFor(Border(), BorderTopLeftRadius(), BorderTopRightRadius(), 1423 BorderTopLeftRadius(), BorderTopRightRadius(), BorderBottomLeftRadius(),
1425 BorderBottomLeftRadius(), BorderBottomRightRadius(), 1424 BorderBottomRightRadius(), border_rect.Size());
1426 border_rect.Size());
1427 rounded_rect.IncludeLogicalEdges(radii, IsHorizontalWritingMode(), 1425 rounded_rect.IncludeLogicalEdges(radii, IsHorizontalWritingMode(),
1428 include_logical_left_edge, 1426 include_logical_left_edge,
1429 include_logical_right_edge); 1427 include_logical_right_edge);
1430 rounded_rect.ConstrainRadii(); 1428 rounded_rect.ConstrainRadii();
1431 } 1429 }
1432 return rounded_rect; 1430 return rounded_rect;
1433 } 1431 }
1434 1432
1435 FloatRoundedRect ComputedStyle::GetRoundedInnerBorderFor( 1433 FloatRoundedRect ComputedStyle::GetRoundedInnerBorderFor(
1436 const LayoutRect& border_rect, 1434 const LayoutRect& border_rect,
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
2362 const NinePieceImage& image) const { 2360 const NinePieceImage& image) const {
2363 return LayoutRectOutsets( 2361 return LayoutRectOutsets(
2364 NinePieceImage::ComputeOutset(image.Outset().Top(), BorderTopWidth()), 2362 NinePieceImage::ComputeOutset(image.Outset().Top(), BorderTopWidth()),
2365 NinePieceImage::ComputeOutset(image.Outset().Right(), BorderRightWidth()), 2363 NinePieceImage::ComputeOutset(image.Outset().Right(), BorderRightWidth()),
2366 NinePieceImage::ComputeOutset(image.Outset().Bottom(), 2364 NinePieceImage::ComputeOutset(image.Outset().Bottom(),
2367 BorderBottomWidth()), 2365 BorderBottomWidth()),
2368 NinePieceImage::ComputeOutset(image.Outset().Left(), BorderLeftWidth())); 2366 NinePieceImage::ComputeOutset(image.Outset().Left(), BorderLeftWidth()));
2369 } 2367 }
2370 2368
2371 void ComputedStyle::SetBorderImageSource(StyleImage* image) { 2369 void ComputedStyle::SetBorderImageSource(StyleImage* image) {
2372 if (Border().image_.GetImage() == image) 2370 if (BorderImage().GetImage() == image)
2373 return; 2371 return;
2374 surround_data_.Access()->border_.image_.SetImage(image); 2372 MutableBorderImageInternal().SetImage(image);
2375 } 2373 }
2376 2374
2377 void ComputedStyle::SetBorderImageSlices(const LengthBox& slices) { 2375 void ComputedStyle::SetBorderImageSlices(const LengthBox& slices) {
2378 if (Border().image_.ImageSlices() == slices) 2376 if (BorderImage().ImageSlices() == slices)
2379 return; 2377 return;
2380 surround_data_.Access()->border_.image_.SetImageSlices(slices); 2378 MutableBorderImageInternal().SetImageSlices(slices);
2381 } 2379 }
2382 2380
2383 void ComputedStyle::SetBorderImageSlicesFill(bool fill) { 2381 void ComputedStyle::SetBorderImageSlicesFill(bool fill) {
2384 if (Border().image_.Fill() == fill) 2382 if (BorderImage().Fill() == fill)
2385 return; 2383 return;
2386 surround_data_.Access()->border_.image_.SetFill(fill); 2384 MutableBorderImageInternal().SetFill(fill);
2387 } 2385 }
2388 2386
2389 void ComputedStyle::SetBorderImageWidth(const BorderImageLengthBox& slices) { 2387 void ComputedStyle::SetBorderImageWidth(const BorderImageLengthBox& slices) {
2390 if (Border().image_.BorderSlices() == slices) 2388 if (BorderImage().BorderSlices() == slices)
2391 return; 2389 return;
2392 surround_data_.Access()->border_.image_.SetBorderSlices(slices); 2390 MutableBorderImageInternal().SetBorderSlices(slices);
2393 } 2391 }
2394 2392
2395 void ComputedStyle::SetBorderImageOutset(const BorderImageLengthBox& outset) { 2393 void ComputedStyle::SetBorderImageOutset(const BorderImageLengthBox& outset) {
2396 if (Border().image_.Outset() == outset) 2394 if (BorderImage().Outset() == outset)
2397 return; 2395 return;
2398 surround_data_.Access()->border_.image_.SetOutset(outset); 2396 MutableBorderImageInternal().SetOutset(outset);
2399 } 2397 }
2400 2398
2401 bool ComputedStyle::BorderObscuresBackground() const { 2399 bool ComputedStyle::BorderObscuresBackground() const {
2402 if (!HasBorder()) 2400 if (!HasBorder())
2403 return false; 2401 return false;
2404 2402
2405 // Bail if we have any border-image for now. We could look at the image alpha 2403 // Bail if we have any border-image for now. We could look at the image alpha
2406 // to improve this. 2404 // to improve this.
2407 if (BorderImage().GetImage()) 2405 if (BorderImage().GetImage())
2408 return false; 2406 return false;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2482 if (value < 0) 2480 if (value < 0)
2483 fvalue -= 0.5f; 2481 fvalue -= 0.5f;
2484 else 2482 else
2485 fvalue += 0.5f; 2483 fvalue += 0.5f;
2486 } 2484 }
2487 2485
2488 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); 2486 return RoundForImpreciseConversion<int>(fvalue / zoom_factor);
2489 } 2487 }
2490 2488
2491 } // namespace blink 2489 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698