Commit ddfe078c authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

Add UseCounter for different shape-outside box types.

I want to see how much shape-outside: content-box, and
shape-outside: padding-box are used relative to the others. There two
values seem like a mis-feature, and if not used will try and get punted
from the spec. (There is non-trivial additional complexity for LayoutNG
eventually).

Change-Id: I13a5d59397bc6e010892c74f452e5cd33a77ee2f
Reviewed-on: https://chromium-review.googlesource.com/1029171
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554637}
parent b012c707
...@@ -1908,6 +1908,10 @@ enum WebFeature { ...@@ -1908,6 +1908,10 @@ enum WebFeature {
kCredentialManagerGetPublicKeyCredential = 2422, kCredentialManagerGetPublicKeyCredential = 2422,
kCredentialManagerMakePublicKeyCredentialSuccess = 2423, kCredentialManagerMakePublicKeyCredentialSuccess = 2423,
kCredentialManagerGetPublicKeyCredentialSuccess = 2424, kCredentialManagerGetPublicKeyCredentialSuccess = 2424,
kShapeOutsideContentBox = 2425,
kShapeOutsidePaddingBox = 2426,
kShapeOutsideBorderBox = 2427,
kShapeOutsideMarginBox = 2428,
// Add new features immediately above this line. Don't change assigned // Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots. // numbers of any item, and don't reuse removed slots.
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "third_party/blink/renderer/core/layout/shapes/shape_outside_info.h" #include "third_party/blink/renderer/core/layout/shapes/shape_outside_info.h"
#include <memory> #include <memory>
#include "third_party/blink/renderer/core/frame/use_counter.h"
#include "third_party/blink/renderer/core/inspector/console_message.h" #include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/layout/api/line_layout_block_flow.h" #include "third_party/blink/renderer/core/layout/api/line_layout_block_flow.h"
#include "third_party/blink/renderer/core/layout/floating_objects.h" #include "third_party/blink/renderer/core/layout/floating_objects.h"
...@@ -49,10 +50,12 @@ CSSBoxType ReferenceBox(const ShapeValue& shape_value) { ...@@ -49,10 +50,12 @@ CSSBoxType ReferenceBox(const ShapeValue& shape_value) {
void ShapeOutsideInfo::SetReferenceBoxLogicalSize( void ShapeOutsideInfo::SetReferenceBoxLogicalSize(
LayoutSize new_reference_box_logical_size) { LayoutSize new_reference_box_logical_size) {
const Document& document = layout_box_.GetDocument();
bool is_horizontal_writing_mode = bool is_horizontal_writing_mode =
layout_box_.ContainingBlock()->Style()->IsHorizontalWritingMode(); layout_box_.ContainingBlock()->Style()->IsHorizontalWritingMode();
switch (ReferenceBox(*layout_box_.Style()->ShapeOutside())) { switch (ReferenceBox(*layout_box_.Style()->ShapeOutside())) {
case CSSBoxType::kMargin: case CSSBoxType::kMargin:
UseCounter::Count(document, WebFeature::kShapeOutsideMarginBox);
if (is_horizontal_writing_mode) if (is_horizontal_writing_mode)
new_reference_box_logical_size.Expand(layout_box_.MarginWidth(), new_reference_box_logical_size.Expand(layout_box_.MarginWidth(),
layout_box_.MarginHeight()); layout_box_.MarginHeight());
...@@ -61,8 +64,10 @@ void ShapeOutsideInfo::SetReferenceBoxLogicalSize( ...@@ -61,8 +64,10 @@ void ShapeOutsideInfo::SetReferenceBoxLogicalSize(
layout_box_.MarginWidth()); layout_box_.MarginWidth());
break; break;
case CSSBoxType::kBorder: case CSSBoxType::kBorder:
UseCounter::Count(document, WebFeature::kShapeOutsideBorderBox);
break; break;
case CSSBoxType::kPadding: case CSSBoxType::kPadding:
UseCounter::Count(document, WebFeature::kShapeOutsidePaddingBox);
if (is_horizontal_writing_mode) if (is_horizontal_writing_mode)
new_reference_box_logical_size.Shrink(layout_box_.BorderWidth(), new_reference_box_logical_size.Shrink(layout_box_.BorderWidth(),
layout_box_.BorderHeight()); layout_box_.BorderHeight());
...@@ -71,6 +76,7 @@ void ShapeOutsideInfo::SetReferenceBoxLogicalSize( ...@@ -71,6 +76,7 @@ void ShapeOutsideInfo::SetReferenceBoxLogicalSize(
layout_box_.BorderWidth()); layout_box_.BorderWidth());
break; break;
case CSSBoxType::kContent: case CSSBoxType::kContent:
UseCounter::Count(document, WebFeature::kShapeOutsideContentBox);
if (is_horizontal_writing_mode) if (is_horizontal_writing_mode)
new_reference_box_logical_size.Shrink( new_reference_box_logical_size.Shrink(
layout_box_.BorderAndPaddingWidth(), layout_box_.BorderAndPaddingWidth(),
......
...@@ -18476,6 +18476,10 @@ Called by update_net_error_codes.py.--> ...@@ -18476,6 +18476,10 @@ Called by update_net_error_codes.py.-->
<int value="2422" label="CredentialManagerGetPublicKeyCredential"/> <int value="2422" label="CredentialManagerGetPublicKeyCredential"/>
<int value="2423" label="CredentialManagerMakePublicKeyCredentialSuccess"/> <int value="2423" label="CredentialManagerMakePublicKeyCredentialSuccess"/>
<int value="2424" label="CredentialManagerGetPublicKeyCredentialSuccess"/> <int value="2424" label="CredentialManagerGetPublicKeyCredentialSuccess"/>
<int value="2425" label="ShapeOutsideContentBox"/>
<int value="2426" label="ShapeOutsidePaddingBox"/>
<int value="2427" label="ShapeOutsideBorderBox"/>
<int value="2428" label="ShapeOutsideMarginBox"/>
</enum> </enum>
<enum name="FeedbackSource"> <enum name="FeedbackSource">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment